1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-22 05:10:56 +00:00

loop: refresh display after every step

This commit is contained in:
Jan Pochyla 2016-10-06 14:41:50 +02:00
parent cc22d59eca
commit c3ee7dd709

View File

@ -2,9 +2,7 @@ import utime
from micropython import const from micropython import const
from uheapq import heappop, heappush, heapify from uheapq import heappop, heappush, heapify
from .utils import type_gen from .utils import type_gen
from . import msg from . import msg, log, ui
from . import log
from . import ui
if __debug__: if __debug__:
# for performance stats # for performance stats
@ -70,6 +68,10 @@ def run_task(task, value):
else: else:
log.error(__name__, '%s is unknown syscall', result) log.error(__name__, '%s is unknown syscall', result)
# after every task step, refresh the screen
# TODO: do not complect the event loop and display
ui.display.refresh()
def handle_message(message): def handle_message(message):
if not paused_tasks: if not paused_tasks:
@ -100,7 +102,6 @@ def run_forever():
# add current delay to ring buffer for performance stats # add current delay to ring buffer for performance stats
log_delay_rb[log_delay_pos] = delay log_delay_rb[log_delay_pos] = delay
log_delay_pos = (log_delay_pos + 1) % log_delay_rb_len log_delay_pos = (log_delay_pos + 1) % log_delay_rb_len
ui.display.refresh()
message = msg.select(delay) message = msg.select(delay)
if message: if message:
handle_message(message) handle_message(message)
@ -201,5 +202,7 @@ class Wait(Syscall):
try: try:
return (yield self) return (yield self)
except: except:
# exception was raised on the waiting task externally with
# close() or throw(), kill the child tasks and re-raise
self.exit() self.exit()
raise raise