No more canaries

This commit is contained in:
Thomas Farstrike
2025-04-28 15:20:49 +02:00
parent 8cb087220c
commit 8827477a8b
5 changed files with 3 additions and 22 deletions
@@ -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)
@@ -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
@@ -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)
@@ -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
@@ -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: