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

seed: use sync backlight sliding

This commit is contained in:
Jan Pochyla 2019-02-21 13:22:57 +01:00
parent f11373c0ee
commit 86bec3b0ae
2 changed files with 22 additions and 1 deletions

View File

@ -60,7 +60,7 @@ async def get_keychain(ctx: wire.Context, namespaces: list) -> Keychain:
return keychain
@ui.layout
@ui.layout_no_slide
async def _compute_seed(ctx: wire.Context) -> bytes:
passphrase = cache.get_passphrase()
if passphrase is None:
@ -73,9 +73,11 @@ async def _compute_seed(ctx: wire.Context) -> bytes:
def _start_bip39_progress():
ui.backlight_slide_sync(ui.BACKLIGHT_DIM)
ui.display.clear()
ui.header("Please wait")
ui.display.refresh()
ui.backlight_slide_sync(ui.BACKLIGHT_NORMAL)
def _render_bip39_progress(progress: int, total: int):

View File

@ -110,6 +110,13 @@ async def backlight_slide(val: int, delay: int = 35000, step: int = 20):
yield sleep
def backlight_slide_sync(val: int, delay: int = 35000, step: int = 20):
current = display.backlight()
for i in range(current, val, -step if current > val else step):
display.backlight(i)
utime.sleep_us(delay)
def layout(f):
async def inner(*args, **kwargs):
await backlight_slide(BACKLIGHT_DIM)
@ -127,6 +134,18 @@ def layout(f):
return inner
def layout_no_slide(f):
async def inner(*args, **kwargs):
try:
layout = f(*args, **kwargs)
workflow.onlayoutstart(layout)
return await layout
finally:
workflow.onlayoutclose(layout)
return inner
def header(
title: str, icon: bytes = ICON_DEFAULT, fg: int = FG, bg: int = BG, ifg: int = GREEN
):