lvgltest: fix it and cleanup

This commit is contained in:
Thomas Farstrike
2025-05-15 07:11:56 +02:00
parent 7b41e86935
commit 08c0370eed
@@ -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: