You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cam_hal): replace recursive cam_take() with bounded loop
– prevents stack-overflow in cam_task
The old cam_take() used recursion to retry if
* no JPEG EOI was found or
* a NULL frame pointer was returned (GDMA glitch on ESP32-S3).
Under heavy loss conditions this could overflow the cam_task stack
and reboot the whole system.
* Re-wrote cam_take() as a single while-loop – stack depth is now
constant and independent of retry count.
* Added strict timeout tracking (`remaining = timeout - elapsed`);
function can never block longer than the caller’s timeout.
* ESP32-S3 only
* capped GDMA reset storms to 3 attempts (`MAX_GDMA_RESETS`)
* logs one “giving up” warning, then yields (`vTaskDelay(1)`)
to avoid busy-spin after hardware is wedged.
* Non-S3 targets
* emit early `ESP_LOGW` when a NULL frame ever appears,
then yield one tick per loop to prevent CPU thrash.
* Maintained existing JPEG-EOI trimming and YUV→GRAY memcpy paths;
behaviour unchanged on successful frames.
* Inline comment links to esp32-camera commit 984999f / issue #620
for future context.
0 commit comments