You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Work on new canary method
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user