fix(firmware): fix ESP32-C3 bootloop — NULL queue guard + correct SPI typedef

Two bugs causing immediate crash on first flash:
1. `Ws2801Spi2MhzMethod` typedef was wrong (had "Neo" prefix that doesn't exist
   in NeoPixelBus 2.8.x), causing compile error
2. `animTickTask` called `xQueueReceive(commandQueue, ...)` before UDP server
   initializes the queue — NULL pointer triggers configASSERT → panic → ~3s
   reboot loop. Added NULL guard so animation ticks safely until WiFi connects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-04-04 19:08:18 +02:00
parent 4553957b6a
commit 5589962422
2 changed files with 13 additions and 4 deletions

View File

@@ -117,10 +117,16 @@ static void animTickTask(void* pvParams) {
TickType_t lastWake = xTaskGetTickCount(); TickType_t lastWake = xTaskGetTickCount();
while (true) { while (true) {
// Drain commandQueue — process ALL pending commands before this frame // Drain commandQueue — process ALL pending commands before this frame.
// Guard against NULL: commandQueue is only created in startUdpServer(),
// which is called only after WiFi connects. If WiFi never connects (e.g.
// wrong credentials, no AP) commandQueue stays NULL and xQueueReceive()
// would panic. Skip queue drain safely until UDP server is up.
LedCommand cmd; LedCommand cmd;
while (xQueueReceive(commandQueue, &cmd, 0) == pdTRUE) { if (commandQueue != NULL) {
applyCommand(cmd); while (xQueueReceive(commandQueue, &cmd, 0) == pdTRUE) {
applyCommand(cmd);
}
} }
// Tick Schrank (WS2801, RGB, 160 LEDs, isRGBW=false) // Tick Schrank (WS2801, RGB, 160 LEDs, isRGBW=false)

View File

@@ -3,9 +3,12 @@
#include "config.h" #include "config.h"
// SK6812: RGBW (4 bytes/LED) — MUST use NeoGrbwFeature, never NeoRgbFeature // SK6812: RGBW (4 bytes/LED) — MUST use NeoGrbwFeature, never NeoRgbFeature
// NeoEsp32RmtNWs2812xMethod uses RMT channel N (0-indexed).
// On ESP32-C3 (RISC-V single-core), only RMT channels 0 and 1 are available.
// NeoEsp32Rmt0Ws2812xMethod = channel 0, pinned to PIN_SK6812 at runtime.
using StripWand = NeoPixelBus<NeoGrbwFeature, NeoEsp32Rmt0Ws2812xMethod>; using StripWand = NeoPixelBus<NeoGrbwFeature, NeoEsp32Rmt0Ws2812xMethod>;
// WS2801: RGB (3 bytes/LED), 2MHz SPI for cable-safe 5m run // WS2801: RGB (3 bytes/LED), 2MHz SPI for cable-safe 5m run
using StripSchrank = NeoPixelBus<NeoRgbFeature, NeoWs2801Spi2MhzMethod>; using StripSchrank = NeoPixelBus<NeoRgbFeature, Ws2801Spi2MhzMethod>;
extern StripWand stripWand; extern StripWand stripWand;
extern StripSchrank stripSchrank; extern StripSchrank stripSchrank;