diff --git a/core/src/boot.py b/core/src/boot.py index ef45059ad..2fb0104d0 100644 --- a/core/src/boot.py +++ b/core/src/boot.py @@ -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: