1616import _thread
1717
1818keeprunning = True
19+ summary = "Running 3 CPU tests...\n \n "
1920
2021# Configuration
2122TEST_DURATION = 5000 # Duration of each test (ms)
@@ -53,7 +54,6 @@ def stress_test_thread():
5354 #
5455 time .sleep_ms (TEST_SPACING )
5556 print ("\n Starting SHA-256 stress test (1KB data)..." )
56- global summary
5757 summary += "Busy loop with SHA-256 (1KB): "
5858 iterations = 0
5959 start_time = time .ticks_ms ()
@@ -68,10 +68,6 @@ def stress_test_thread():
6868 summary += "\n All tests completed."
6969
7070
71- def update_status_cb (timer ):
72- status .set_text (summary )
73-
74-
7571def janitor_cb (timer ):
7672 global keeprunning
7773 if lv .screen_active () != appscreen :
@@ -82,15 +78,11 @@ def janitor_cb(timer):
8278
8379appscreen = lv .screen_active ()
8480janitor = lv .timer_create (janitor_cb , 500 , None )
85- update_status_timer = lv .timer_create (update_status_cb , 200 , None )
81+ update_status_timer = lv .timer_create (lambda timer : status . set_text ( summary ) , 200 , None )
8682
8783status = lv .label (appscreen )
8884status .align (lv .ALIGN .TOP_LEFT , 5 , 10 )
89- status .set_style_text_color (lv .color_hex (0xFFFFFF ), 0 )
90-
91- summary = "Running 3 CPU tests...\n \n "
9285status .set_text (summary )
9386
9487_thread .stack_size (12 * 1024 )
9588_thread .start_new_thread (stress_test_thread , ())
96-
0 commit comments