fix: three stack overflows crashing firmware on TimerCamera-F

loopTask: cv_init() created a CVState{} temporary (9KB background
array) on the stack — fixed by initializing members directly.

cam task: cv_process() had uint8_t fg[CV_PIXELS] (9KB) as a local
variable — made static, matching the existing fg_copy fix.

cam task stack bumped from 4096 to 8192 for headroom.

Also: switch to 4MB OTA partition table (TimerCamera-F has 4MB flash,
not 8MB), add CONFIG_ARDUINO_LOOP_STACK_SIZE=16384 build flag,
upload_speed=115200 and --no-stub for reliable CH340 flashing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-15 10:58:06 -07:00
parent 265fb727ab
commit 4b671843b3
4 changed files with 21 additions and 6 deletions

View File

@@ -6,15 +6,17 @@ default_envs = timercam
platform = espressif32@6.6.0
board = m5stack-timer-cam
framework = arduino
board_build.partitions = partitions_8mb_ota.csv
board_build.partitions = partitions_4mb_ota.csv
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-DCORE_DEBUG_LEVEL=3
-DCONFIG_BT_NIMBLE_ENABLED=1
-DCONFIG_SPIRAM_USE_MALLOC=1
-DCONFIG_ARDUINO_LOOP_STACK_SIZE=16384
monitor_speed = 115200
upload_speed = 921600
upload_speed = 115200
upload_flags = --no-stub
lib_deps =
tzapu/WiFiManager@^2.0.17
bblanchon/ArduinoJson@^7.0.0