mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
Handle exceptions in better way, enable to return to main screen many times.
This commit is contained in:
parent
ab9141dd95
commit
92eeac3612
@ -1,4 +1,5 @@
|
||||
import sys
|
||||
import utime
|
||||
|
||||
_new_layout = None
|
||||
_current_layout = None
|
||||
@ -15,17 +16,18 @@ def set_main(main_layout):
|
||||
global _new_layout
|
||||
global _current_layout
|
||||
|
||||
_current_layout = main_layout
|
||||
_current_layout = main_layout()
|
||||
while True:
|
||||
try:
|
||||
_current_layout = yield from _current_layout
|
||||
except Exception as e:
|
||||
sys.print_exception(e)
|
||||
sys.exit()
|
||||
utime.sleep(1) # Don't produce wall of exceptions
|
||||
# if _current_layout == main_layout:
|
||||
# # Main layout thrown exception, what to do?
|
||||
# _current_layout = main_layout
|
||||
# continue
|
||||
# sys.exit()
|
||||
_current_layout = main_layout()
|
||||
continue
|
||||
|
||||
if _new_layout != None:
|
||||
print("Switching to new layout %s" % _new_layout)
|
||||
|
Loading…
Reference in New Issue
Block a user