From fc9a4bcc657940903aee41f7691096e26e57c9c1 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Fri, 16 May 2025 12:21:57 +0200 Subject: [PATCH] cputest: simplify --- .../apps/com.example.cputest/assets/cputest.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/internal_filesystem/apps/com.example.cputest/assets/cputest.py b/internal_filesystem/apps/com.example.cputest/assets/cputest.py index 9fb6479a..deff398c 100644 --- a/internal_filesystem/apps/com.example.cputest/assets/cputest.py +++ b/internal_filesystem/apps/com.example.cputest/assets/cputest.py @@ -16,6 +16,7 @@ import os import _thread keeprunning = True +summary = "Running 3 CPU tests...\n\n" # Configuration TEST_DURATION = 5000 # Duration of each test (ms) @@ -53,7 +54,6 @@ def stress_test_thread(): # time.sleep_ms(TEST_SPACING) print("\nStarting SHA-256 stress test (1KB data)...") - global summary summary += "Busy loop with SHA-256 (1KB): " iterations = 0 start_time = time.ticks_ms() @@ -68,10 +68,6 @@ def stress_test_thread(): summary += "\nAll tests completed." -def update_status_cb(timer): - status.set_text(summary) - - def janitor_cb(timer): global keeprunning if lv.screen_active() != appscreen: @@ -82,15 +78,11 @@ def janitor_cb(timer): appscreen = lv.screen_active() janitor = lv.timer_create(janitor_cb, 500, None) -update_status_timer = lv.timer_create(update_status_cb, 200, None) +update_status_timer = lv.timer_create(lambda timer: status.set_text(summary), 200, None) status = lv.label(appscreen) status.align(lv.ALIGN.TOP_LEFT, 5, 10) -status.set_style_text_color(lv.color_hex(0xFFFFFF), 0) - -summary = "Running 3 CPU tests...\n\n" status.set_text(summary) _thread.stack_size(12*1024) _thread.start_new_thread(stress_test_thread, ()) -