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

fix(core): restore filled-lock display time

This commit is contained in:
matejcik 2023-11-28 11:45:22 +01:00 committed by TychoVrahe
parent 7b442a2b20
commit c5fc92e36a

View File

@ -1,11 +1,13 @@
# isort:skip_file
import trezorui2
import utime
# Showing welcome screen as soon as possible
# (display is also prepared on that occasion).
# Remembering time to control how long we show it.
trezorui2.draw_welcome_screen()
welcome_screen_start_ms = utime.ticks_ms()
import storage
import storage.device
@ -19,6 +21,17 @@ from trezor.ui.layouts.homescreen import Lockscreen
from apps.common.request_pin import can_lock_device, verify_user_pin
_WELCOME_SCREEN_MS = 1200 # how long do we want to show welcome screen (minimum)
def enforce_welcome_screen_duration() -> None:
"""Make sure we will show the welcome screen for appropriate amount of time."""
# Not wasting the time in emulator debug builds (debugging and development)
if __debug__ and utils.EMULATOR:
return
while utime.ticks_ms() - welcome_screen_start_ms < _WELCOME_SCREEN_MS:
utime.sleep_ms(100)
async def bootscreen() -> None:
"""Sequence of actions to be done on boot (after device is connected).
@ -34,9 +47,11 @@ async def bootscreen() -> None:
while True:
try:
if can_lock_device():
enforce_welcome_screen_duration()
await lockscreen
await verify_user_pin()
storage.init_unlocked()
enforce_welcome_screen_duration()
allow_all_loader_messages()
return
except wire.PinCancelled: