From 8827477a8b1bb26616c9357f4ddc6c200ceab537 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Mon, 28 Apr 2025 15:20:49 +0200 Subject: [PATCH] No more canaries --- internal_filesystem/apps/com.example.app2/assets/app2.py | 5 +---- .../apps/com.example.camtest/assets/camtest.py | 5 ----- .../apps/com.example.launcher/assets/launcher.py | 7 ------- .../apps/com.example.memtest/assets/memtest.py | 2 +- .../apps/com.example.wstest/assets/bitcoin_transactions.py | 6 +----- 5 files changed, 3 insertions(+), 22 deletions(-) diff --git a/internal_filesystem/apps/com.example.app2/assets/app2.py b/internal_filesystem/apps/com.example.app2/assets/app2.py index 95d1fe8d..3193305d 100644 --- a/internal_filesystem/apps/com.example.app2/assets/app2.py +++ b/internal_filesystem/apps/com.example.app2/assets/app2.py @@ -7,12 +7,9 @@ print("App2 running") # Quit flag should_continue = True -canary = lv.obj(subwindow) -canary.add_flag(lv.obj.FLAG.HIDDEN) - def app2_thread(): count=0 - while should_continue and canary.is_valid(): + while should_continue and appscreen == lv.screen_active(): print(f"app2_thread: thread_id {_thread.get_ident()} - {count}") count+=1 time.sleep(1) diff --git a/internal_filesystem/apps/com.example.camtest/assets/camtest.py b/internal_filesystem/apps/com.example.camtest/assets/camtest.py index 86abd916..980e7107 100644 --- a/internal_filesystem/apps/com.example.camtest/assets/camtest.py +++ b/internal_filesystem/apps/com.example.camtest/assets/camtest.py @@ -30,11 +30,6 @@ #i2c.writeto_mem(sensor_addr, reg_addr, bytes([reg_value])) - -#subwindow.clean() -#canary = lv.obj(subwindow) -#canary.add_flag(lv.obj.FLAG.HIDDEN) - #width = 480 #height = 320 #width = 320 diff --git a/internal_filesystem/apps/com.example.launcher/assets/launcher.py b/internal_filesystem/apps/com.example.launcher/assets/launcher.py index db372140..d0aced50 100644 --- a/internal_filesystem/apps/com.example.launcher/assets/launcher.py +++ b/internal_filesystem/apps/com.example.launcher/assets/launcher.py @@ -11,9 +11,6 @@ import uos - -#myscreen = lv.screen_active() - # Create a container for the grid cont = lv.obj(subwindow) cont.set_size(lv.pct(100), lv.pct(100)) @@ -85,7 +82,3 @@ for app_dir in [d for d in uos.listdir(apps_dir) if uos.stat(f"{apps_dir}/{d}")[ end = time.ticks_ms() print(f"Displaying all icons took: {end-start}ms") -#print("checking active...") -#while myscreen == lv.screen_active(): -# print("still active") -# time.sleep_ms(500) diff --git a/internal_filesystem/apps/com.example.memtest/assets/memtest.py b/internal_filesystem/apps/com.example.memtest/assets/memtest.py index dbc84c1f..d07fcd60 100644 --- a/internal_filesystem/apps/com.example.memtest/assets/memtest.py +++ b/internal_filesystem/apps/com.example.memtest/assets/memtest.py @@ -40,7 +40,7 @@ def test_allocation(buffer_size, n): count = 0 try: - while canary.is_valid(): + while appscreen == lv.screen_active(): # Measure time for allocation start_time = time.ticks_ms() # Allocate a new buffer diff --git a/internal_filesystem/apps/com.example.wstest/assets/bitcoin_transactions.py b/internal_filesystem/apps/com.example.wstest/assets/bitcoin_transactions.py index a8857db3..08b07f99 100644 --- a/internal_filesystem/apps/com.example.wstest/assets/bitcoin_transactions.py +++ b/internal_filesystem/apps/com.example.wstest/assets/bitcoin_transactions.py @@ -6,10 +6,6 @@ import urandom import uhashlib import time -subwindow.clean() -canary = lv.obj(subwindow) -canary.add_flag(lv.obj.FLAG.HIDDEN) - def compute_accept_key(key): GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" hash_obj = uhashlib.sha1(key + GUID) @@ -197,7 +193,7 @@ try: print("Subscribing unconfirmed transactions...") ws_send_text(sock, ujson.dumps({"op": "unconfirmed_sub"})) - while canary.is_valid(): + while appscreen == lv.screen_active(): time.sleep(1) data = ws_read_frame(sock) # Bug: when a giant response comes in, it cuts off after 5470 bytes and then the rest is read as a new (garbled) response if data: