1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-17 14:28:47 +00:00

fix(core): preallocate save_screen_directory to allow heap checking

Otherwise, free heap memory will decrease after handling `DebugLinkRecordScreen`.

[no changelog]
This commit is contained in:
Roman Zeyde 2025-04-22 15:46:31 +03:00 committed by Roman Zeyde
parent bd9d303310
commit a787d21b3f
2 changed files with 6 additions and 4 deletions

View File

@ -47,7 +47,7 @@ if __debug__:
# Starting with "refresh00", allowing for 100 emulator restarts
# without losing the order of the screenshots based on filename.
display.save(
storage.save_screen_directory + f"/refresh{REFRESH_INDEX:0>2}-"
f"{storage.save_screen_directory.decode()}/refresh{REFRESH_INDEX:0>2}-"
)
return True
return False
@ -298,7 +298,7 @@ if __debug__:
# so that the screenshots are not overwritten.
global REFRESH_INDEX
REFRESH_INDEX = msg.refresh_index
storage.save_screen_directory = msg.target_directory
storage.save_screen_directory[:] = msg.target_directory.encode()
storage.save_screen = True
# force repaint current layout, in order to take an initial screenshot

View File

@ -1,11 +1,13 @@
from trezorutils import halt
from trezorutils import EMULATOR, halt
if not __debug__:
halt("Debugging is disabled")
if __debug__:
save_screen = False
save_screen_directory = "."
if EMULATOR:
save_screen_directory = bytearray(4096)
save_screen_directory[:] = b"."
layout_watcher = False