Fix hardware-verified bugs: EPD stack overflow and busy-wait spin

Two crashes found flashing to real hardware:

- epd_display_stream's 4KB SPI chunk buffer was a stack local, but the
  default main task stack (3584 bytes) is smaller than that alone --
  Guru Meditation stack protection fault. Made it static instead, and
  bumped CONFIG_ESP_MAIN_TASK_STACK_SIZE to 8192 for headroom in the rest
  of the boot call chain (provisioning -> QR render -> eventually the
  HTTP fetch cycle all run in this one task).

- epd_wait_busy() polled with a 1ms vTaskDelay, which rounds down to 0
  FreeRTOS ticks at the default 100Hz tick rate -- so it never actually
  blocked, tight-spinning the CPU for the panel's real refresh time
  (15-30+s for a full-color pass) and starving the idle task long enough
  to trip the 5s task watchdog. Bumped to 20ms, safely >=1 tick regardless
  of tick rate.

Also updates the EPD pin defaults to the board's actual wiring
(CLK=20 MOSI=19 CS=18 DC=9 RST=10 BUSY=11), confirmed working on hardware.
This commit is contained in:
2026-07-18 14:06:54 -04:00
parent 1dd02da70a
commit 1b9226326a
3 changed files with 34 additions and 10 deletions
+7
View File
@@ -7,3 +7,10 @@ CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
# The whole boot flow (provisioning, QR rendering, and eventually the HTTP
# fetch cycle) runs in the single default "main" task. The 3584-byte
# default already crashed with a stack protection fault once (a 4KB SPI
# chunk buffer that's since been moved off the stack) -- bumping this gives
# headroom for the rest of that call chain plus the upcoming HTTP client.
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192