Repository navigation
fix(autoresearch): use GPIO18/19 as default TX/RX on classic ESP32 (#3452) - #3455
Conversation
…#3452) Adds a once-per-loop heartbeat at the very top of `loop()` that prints via two parallel paths so we can isolate the failure mode on the silent-RPC classic ESP32-WROOM described in #3452: Path A: fl::println(...) — through the FastLED IO singleton (UartEsp32 + EspIO + fl::print). Path B: Serial.print/println(...) — straight to Arduino HardwareSerial. The heartbeat is non-destructive (never consumes a byte) so the RPC parser still sees all UART input. Both paths fire on the first iteration and then every 1 s; each line includes the iteration counter, millis(), and the live `Serial.available()` / `fl::available()` counts. First-flash result on the user's COM11 board (#3452 follow-up): [ 2.66s] [#3452:raw] iter=1 avail=0 ← Path B (Arduino Serial) [ 3.37s] (single space character) ← Path A (fl::println)? nothing else for 15 s. Two diagnoses fall out of that: * `fl::println` is silently failing on this board (Path A produces either nothing or a single byte; the full line never lands). Suggests the FastLED `EspIO`/`UartEsp32` singleton's `mBuffered` / `mPortInt` state is no longer pointing at a healthy driver by the time `loop()` runs, even though Arduino's UART path still works fine. * `loop()` only iterates once. The for-loop in `loop()` that pumps `fl::task::run()` 100× wedges on the very first pass — so the RPC-polling task (which calls `remote_control.tick()`, which in turn pulls via `fl::available()`/`fl::readLine`) blocks forever or starves the rest of the loop. Filed against issue #3452. To delete once the singleton-vs-Arduino divergence is root-caused. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds before/after Serial.print bookends around the per-loop `for (i=0; i<100; i++) fl::task::run();` block so we can tell which side of the pump the device wedges in. Observed on the user's classic ESP32-WROOM: [ 2.67s] [#3452:raw] iter=1 avail=0 [ 2.67s] [#3452:raw] before for(100) iter=1 [ 3.37s] [#3 ← OUTPUT TRUNCATES MID-PRINT So at 3.37 s (700 ms into the first call to fl::task::run), in the middle of emitting the "[#3452:raw] after for(100) iter=1" line, the UART TX path stops working part-way through writing. The chip is still alive (no reset, no boot message), but `Serial.print` is dropping bytes on the floor mid-string. The next loop iteration's heartbeat never makes it onto the wire either. That's not a "task blocks forever" pattern — that's a "UART driver gets clobbered while a Serial.print is in progress." Strongly consistent with one of the FastLED background tasks (the wave8 UART driver's `UartPeripheralEsp::initialize(UART_NUM_0, …)` is the prime suspect — it calls `uart_driver_install()` + `uart_set_line_inverse()` on UART0, which would invalidate Arduino's `HardwareSerial` driver silently the instant it fires). Next investigation step: print which tasks the scheduler is currently running so we can name the culprit, then look at why something is calling into wave8 UART initialize from a background task without an RPC trigger. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…3452) The autoresearch sketch defaulted `PIN_TX=1` / `PIN_RX=0` on classic ESP32 (FL_IS_ESP_32DEV / esp32dev). GPIO 1 is the UART0 TX pin (the Arduino `Serial` console output that bash autoresearch reads), and GPIO 0 is a boot-strap pin. On loop() entry the GPIO baseline test (`testRxChannel(rx_channel, PIN_TX, PIN_RX, ...)`) toggles PIN_TX as a digital output, instantly killing UART0 — manifesting as the "device emits ready event then goes silent" symptom in #3452. Switch the classic-ESP32 defaults to GPIO 18 / 19, which are general-purpose pins not muxed to UART0 and not on the boot-strap list. The rest of the platform-specific defaults stay as-is. Also harden loop() against a null rx_channel: skip the GPIO baseline testRxChannel call when `g_autoresearch_state->rx_channel` is null, which prevents an immediate panic if the RX channel creation in setup() ever fails on a future platform. Drops the temporary `#3452` diagnostic heartbeat prints added on branch `diag/3452-loop-heartbeat`. Validated on the user's WROOM board (COM11): device boots → emits `ready` (pinRx:19, pinTx:18, drivers:5) → emits `gpioBaseline` → responds to ping RPC → emits periodic `status` events. Pre-fix: same boot then UART silence. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughModifies the AutoResearch example for classic ESP32: AutoResearchPlatform.h adds explicit FL_IS_ESP_32DEV pin branches defaulting TX to GPIO18 and RX to GPIO19, with documentation on GPIO0/1/3 caveats. AutoResearch.ino tightens the GPIO baseline test condition to also require a non-null rx_channel. ChangesAutoResearch ESP32 pin defaults and RX guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Resolves #3452 — "RPC silence on classic ESP32-WROOM".
The autoresearch sketch defaulted
PIN_TX=1/PIN_RX=0on classic ESP32 (FL_IS_ESP_32DEV/esp32dev). GPIO 1 is the UART0 TX pin — the ArduinoSerialconsole output thatbash autoresearchreads via the USB-Serial bridge — and GPIO 0 is a boot-strap pin. The first loop() iteration callstestRxChannel(rx_channel, PIN_TX, PIN_RX, ...)which togglesPIN_TXas a digital output, instantly killing UART0. That's the "device boots, emits ready, then goes silent" symptom.Switching the classic-ESP32 defaults to GPIO 18 / 19 — both general-purpose, not muxed to UART0, not on the boot-strap list — restores the console for the lifetime of the sketch. Other platform defaults are untouched.
Also adds a null guard around the GPIO baseline test so a future RX-channel creation failure cannot panic loop() with a nullptr deref.
Diagnostic heartbeat prints that lived briefly on
diag/3452-loop-heartbeatare removed; the root cause is fixed, the bisection scaffolding isn't needed.Validation
Tested on the user's WROOM board (COM11). Pre-fix: device sends
RESULT: {... \"ready\":true ... \"pinTx\":1, \"pinRx\":0 ...}and then UART0 stays silent forever. Post-fix:Test plan
bash autoresearchend-to-end on classic ESP32 (next PR — separate handler issue tracked locally)#elsebranch moved)🤖 Generated with Claude Code
Summary by CodeRabbit