From dd7f5289e2bada95707b21d151a2cb9a4c1b00f2 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 21 Mar 2024 13:38:44 +0100 Subject: [PATCH] feat(core): drop support for after-step-hook This was necessary for hooking display.refresh() with the old UI toolkit. With the new one, we explicitly refresh the display after every paint, so implicit after-step refresh seems no longer necessary. --- core/.changelog.d/3633.changed | 1 + core/src/trezor/loop.py | 5 ----- core/src/trezor/ui/__init__.py | 5 ----- 3 files changed, 1 insertion(+), 10 deletions(-) create mode 100644 core/.changelog.d/3633.changed diff --git a/core/.changelog.d/3633.changed b/core/.changelog.d/3633.changed new file mode 100644 index 0000000000..dcc32f9a26 --- /dev/null +++ b/core/.changelog.d/3633.changed @@ -0,0 +1 @@ +Improved device responsiveness by removing unnecessary screen refreshes. diff --git a/core/src/trezor/loop.py b/core/src/trezor/loop.py index 856bc7c971..833be21be1 100644 --- a/core/src/trezor/loop.py +++ b/core/src/trezor/loop.py @@ -20,9 +20,6 @@ if TYPE_CHECKING: AwaitableTask = Task | Awaitable Finalizer = Callable[[Task, Any], None] -# function to call after every task step -after_step_hook: Callable[[], None] | None = None - # tasks scheduled for execution in the future _queue = utimeq.utimeq(64) @@ -179,8 +176,6 @@ def _step(task: Task, value: Any) -> None: else: if __debug__: log.error(__name__, "unknown syscall: %s", result) - if after_step_hook: - after_step_hook() class Syscall: diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index 650d38917b..ba9882d10e 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -60,11 +60,6 @@ else: refresh = display.refresh -# in both debug and production, emulator needs to draw the screen explicitly -if utils.EMULATOR or utils.INTERNAL_MODEL == "T2B1" or utils.INTERNAL_MODEL == "T3B1": - loop.after_step_hook = refresh - - async def _alert(count: int) -> None: short_sleep = loop.sleep(20) long_sleep = loop.sleep(80)