You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
lvgltest: fix it and cleanup
This commit is contained in:
@@ -10,9 +10,7 @@ SPINNER_SIZE = 40 # Size of each spinner in pixels
|
||||
spinner_count = 0
|
||||
metrics_label = None
|
||||
|
||||
|
||||
|
||||
def add_spinner_and_update():
|
||||
def add_spinner_and_update(timer):
|
||||
global spinner_count, metrics_label
|
||||
try:
|
||||
x = random.randint(0, appscreen.get_width() - SPINNER_SIZE)
|
||||
@@ -32,19 +30,21 @@ def add_spinner_and_update():
|
||||
def run_benchmark():
|
||||
global spinner_count, metrics_label
|
||||
print("Starting LVGL spinner benchmark...")
|
||||
|
||||
metrics_label = lv.label(appscreen)
|
||||
metrics_label.set_style_text_color(lv.color_white(), 0)
|
||||
metrics_label.set_style_bg_color(lv.color_black(), 0)
|
||||
metrics_label.set_style_bg_opa(lv.OPA.COVER, 0)
|
||||
metrics_label.set_pos(10, 10)
|
||||
metrics_label.set_text("Spinners: 0")
|
||||
|
||||
timer = lv.timer_create(add_spinner_and_update, 2000, None)
|
||||
th.disable() # taskhandler control is necessary, otherwise there are concurrency issues
|
||||
while appscreen == lv.screen_active():
|
||||
add_spinner_and_update()
|
||||
time.sleep(4)
|
||||
lv.task_handler()
|
||||
time.sleep_ms(10)
|
||||
lv.tick_inc(10)
|
||||
th.enable()
|
||||
timer.delete()
|
||||
|
||||
|
||||
try:
|
||||
run_benchmark()
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user