1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

fix(core): fix backlight fading when changing screens/layouts

[no changelog]
This commit is contained in:
tychovrahe 2022-12-08 12:17:18 +01:00 committed by TychoVrahe
parent 12f87aa01e
commit 14f8e88e01
3 changed files with 3 additions and 2 deletions

View File

@ -99,6 +99,7 @@ def backlight_fade(val: int, delay: int = 14000, step: int = 15) -> None:
for i in range(current, val, step):
display.backlight(i)
utime.sleep_us(delay)
display.backlight(val)
def header(

View File

@ -136,7 +136,7 @@ class RustLayout(ui.Layout):
def _first_paint(self) -> None:
# Clear the screen of any leftovers.
ui.backlight_fade(ui.style.BACKLIGHT_DIM)
ui.backlight_fade(ui.style.BACKLIGHT_NONE)
ui.display.clear()
self._paint()

View File

@ -6,7 +6,7 @@ from trezor.ui import rgb
BACKLIGHT_NORMAL = const(150)
BACKLIGHT_LOW = const(45)
BACKLIGHT_DIM = const(5)
BACKLIGHT_NONE = const(2)
BACKLIGHT_NONE = const(0)
BACKLIGHT_MAX = const(255)
# color palette