cputest: simplify

This commit is contained in:
Thomas Farstrike
2025-05-16 12:21:57 +02:00
parent 5c059b55ca
commit fc9a4bcc65
@@ -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, ())