diff --git a/internal_filesystem/apps/com.example.camtest/assets/camtest.py b/internal_filesystem/apps/com.example.camtest/assets/camtest.py index f206ae51..3fde9d01 100644 --- a/internal_filesystem/apps/com.example.camtest/assets/camtest.py +++ b/internal_filesystem/apps/com.example.camtest/assets/camtest.py @@ -30,9 +30,11 @@ #i2c.writeto_mem(sensor_addr, reg_addr, bytes([reg_value])) -subwindow.clean() -canary = lv.obj(subwindow) -canary.add_flag(lv.obj.FLAG.HIDDEN) +myscreen = lv.screen_active() + +#subwindow.clean() +#canary = lv.obj(subwindow) +#canary.add_flag(lv.obj.FLAG.HIDDEN) #width = 480 #height = 320 @@ -127,13 +129,9 @@ try_capture() import time +while myscreen == lv.screen_active(): + try_capture() + time.sleep_ms(100) # Allow for the MicroPython REPL to still work -try: - while canary.is_valid(): - try_capture() - time.sleep_ms(100) # Allow for the MicroPython REPL to still work -except lv.LvReferenceError: # triggers when the canary dies - print("Canary died, deinitializing camera...") - cam.deinit() - +print("App backgrounded, deinitializing camera...") cam.deinit() diff --git a/internal_filesystem/main.py b/internal_filesystem/main.py index 6b49f286..b593c42d 100644 --- a/internal_filesystem/main.py +++ b/internal_filesystem/main.py @@ -325,7 +325,7 @@ def execute_script(script_source, is_file, is_launcher): print(f"Thread {thread_id}: script {compile_name} finished") if prevscreen and not is_launcher: print("/main.py: execute_script(): cleaning subwindow...") - subwindow.clean() + #subwindow.clean() timer1.delete() timer2.delete() timer3.delete()