mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-19 19:12:03 +00:00
pin: avoid overdraw
This commit is contained in:
parent
bd812fecf9
commit
7533409765
@ -5,9 +5,16 @@ def pin_to_int(pin: str) -> int:
|
|||||||
return int("1" + pin)
|
return int("1" + pin)
|
||||||
|
|
||||||
|
|
||||||
|
_previous_progress = None
|
||||||
|
|
||||||
|
|
||||||
def show_pin_timeout(seconds: int, progress: int, message: str) -> bool:
|
def show_pin_timeout(seconds: int, progress: int, message: str) -> bool:
|
||||||
|
global _previous_progress
|
||||||
|
|
||||||
if progress == 0:
|
if progress == 0:
|
||||||
ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG)
|
if progress != _previous_progress:
|
||||||
|
# avoid overdraw in case of repeated progress calls
|
||||||
|
ui.display.clear()
|
||||||
ui.display.text_center(
|
ui.display.text_center(
|
||||||
ui.WIDTH // 2, 37, message, ui.BOLD, ui.FG, ui.BG, ui.WIDTH
|
ui.WIDTH // 2, 37, message, ui.BOLD, ui.FG, ui.BG, ui.WIDTH
|
||||||
)
|
)
|
||||||
@ -37,4 +44,6 @@ def show_pin_timeout(seconds: int, progress: int, message: str) -> bool:
|
|||||||
ui.WIDTH,
|
ui.WIDTH,
|
||||||
)
|
)
|
||||||
ui.display.refresh()
|
ui.display.refresh()
|
||||||
|
|
||||||
|
_previous_progress = progress
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user