Fix camera again...

This commit is contained in:
Thomas Farstrike
2025-05-12 19:31:16 +02:00
parent d83f6ba99a
commit 84baebd8dd
3 changed files with 15 additions and 10 deletions
+7 -3
View File
@@ -616,16 +616,20 @@ def log_callback(level, log_str):
# Register log callback
lv.log_register_print_cb(log_callback)
# Function to get FPS
def get_fps():
return fps_buffer[0]
fps = get_fps()
if fps > 0: # Only print when FPS is updated
print("Current FPS:", fps)
#fps = get_fps()
#if fps > 0: # Only print when FPS is updated
# print("Current FPS:", fps)
# Main loop
for _ in range(10):
import time
fps = get_fps()
if fps > 0: # Only print when FPS is updated
print("Current FPS:", fps)
@@ -94,8 +94,8 @@ cam = Camera(
xclk_freq=20000000,
powerdown_pin=-1,
reset_pin=-1,
#pixel_format=PixelFormat.RGB565,
pixel_format=PixelFormat.GRAYSCALE,
pixel_format=PixelFormat.RGB565,
#pixel_format=PixelFormat.GRAYSCALE,
frame_size=FrameSize.R240X240,
grab_mode=GrabMode.LATEST
)
@@ -120,11 +120,11 @@ image_dsc = lv.image_dsc_t({
"magic": lv.IMAGE_HEADER_MAGIC,
"w": width,
"h": height,
"stride": width ,
#"cf": lv.COLOR_FORMAT.RGB565
"cf": lv.COLOR_FORMAT.L8
"stride": width *2,
"cf": lv.COLOR_FORMAT.RGB565
#"cf": lv.COLOR_FORMAT.L8
},
'data_size': width * height,
'data_size': width * height*2,
'data': None # Will be updated per frame
})
+2 -1
View File
@@ -67,7 +67,8 @@ def execute_script_new_thread(scriptname, is_file, is_launcher, is_graphical):
# 168KB maximum at startup but 136KB after loading display, drivers, LVGL gui etc so let's go for 128KB for now, still a lot...
# But then no additional threads can be created. A stacksize of 32KB allows for 4 threads, so 3 in the app itself, which might be tight.
# 16KB allows for 10 threads in the apps, but seems too tight for urequests on unix (desktop) targets
_thread.stack_size(24576)
#_thread.stack_size(24576) # causes camera issue...
_thread.stack_size(16384)
_thread.start_new_thread(execute_script, (scriptname, is_file, is_launcher, is_graphical))
except Exception as e:
print("main.py: execute_script_new_thread(): error starting new thread thread: ", e)