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
{{ message }}
Repository navigation
esp32: default serial IO to io_esp_idf.hpp — make io_arduino.hpp opt-in, drop the <Arduino.h> probe #3720
Line 35: when FL_ESP_USE_IDF_SERIAL == 0, includes platforms/arduino/io_arduino.hpp — pulling the Arduino Serial object into the print path.
A full IDF-native backend already exists and is battle-tested: io_esp_idf.hpp with detail/io_esp_jtag_or_uart.hpp (runtime USB-Serial-JTAG vs UART selection; see #2665/#2668 history). The Arduino backend survives mainly for the case where the sketch and FastLED must share the Serial object's buffering/CDC state.
Fix
Flip the default: FL_ESP_USE_IDF_SERIAL defaults to 1 on all ESP32 builds. The USB-JTAG-vs-UART decision already lives in detail/io_esp_jtag_or_uart.hpp and does not need <Arduino.h> probing.
io_arduino.hpp routing becomes opt-in (FASTLED_ESP32_ARDUINO_SERIAL=1) for users who need fl::print interleaved with their own Serial writes through Arduino's buffers.
Remove the FL_HAS_INCLUDE(<Arduino.h>) probe from this file.
Risks / compat notes
Behavior risk, not compile risk: on Arduino builds with ARDUINO_USB_CDC_ON_BOOT=1, Arduino's CDC console and the IDF driver can contend for the USB-Serial-JTAG peripheral. The detail/io_esp_jtag_or_uart.hpp non-blocking/no-host contract (fl::print: minimal-surface contract — non-blocking on missing CDC host, USJ LL fallback on ESP32 USJ chips #2668) must hold in that configuration — test S3 (USB-OTG CDC) and C3/C6 (USB-Serial-JTAG) explicitly, plus classic ESP32 (UART0-only).
IDF version spread: UART driver source_clk handling for 3.x/4.x/5.x already exists in uart_peripheral_esp.cpp.hpp:34-40; the console path should reuse it.
Acceptance criteria
fl::print/fl::println output verified on: classic ESP32 (UART0), C6 (USB-Serial-JTAG), S3 (CDC) — under both Arduino and -DFL_NO_ARDUINO compiles.
No <Arduino.h> probe remains in io_esp.cpp.hpp.
AutoResearch RPC (which depends on serial IO) still works on the bench boards.
Closing without a code change after re-reading io_esp.cpp.hpp closely.
The original meta-issue audit (based on a broad Explore-agent sweep, not a line-by-line read) characterized this file as probing <Arduino.h> presence and defaulting to Arduino Serial whenever it's found. On closer reading that's not quite right:
#ifndef FL_ESP_USE_IDF_SERIAL
#if !FL_HAS_INCLUDE(<Arduino.h>)
#defineFL_ESP_USE_IDF_SERIAL1// Arduino not available - use ESP-IDF
#elif (... USB-CDC-capable chip in device mode without CDC-on-boot ...)
#defineFL_ESP_USE_IDF_SERIAL1// Arduino Serial is UART0; use USB-Serial-JTAG
#else
#defineFL_ESP_USE_IDF_SERIAL0// Arduino available - use Arduino Serial by default
#endif
#endif
Arduino + everything else: defaults to Arduino Serial. This is intentional, not accidental Arduino coupling — it preserves interop with a user sketch's own Serial.print() calls sharing the same buffered object.
Flipping this default unconditionally (my original sub-issue draft) would risk regressing the #2665/#2668 hardware bring-up work without the multi-chip hardware validation (classic ESP32 UART0-only, C3/C6 USB-Serial-JTAG, S3 USB-OTG-CDC) that would be needed to prove it safe — for a case that, on inspection, isn't actually broken.
No code change needed. Closing as already-satisfied; #3715 no longer lists this as required work.
Activity
zackees commentedon Jul 22, 2026
Closing without a code change after re-reading
io_esp.cpp.hppclosely.The original meta-issue audit (based on a broad Explore-agent sweep, not a line-by-line read) characterized this file as probing
<Arduino.h>presence and defaulting to Arduino Serial whenever it's found. On closer reading that's not quite right:Arduino.hgenuinely absent): already selectsio_esp_idf.hpp(line 16-17). This is exactly the capability-detection pattern esp: converge Arduino-vs-native dispatch on capability detection (FL_HAS_INCLUDE of IDF driver headers), not #ifdef ARDUINO #3722 wants — not#ifdef ARDUINO.io_esp_idf.hppis a complete implementation (delegates toEspIO::instance()), not a stub. Bare-IDF builds already get working serial I/O with no code change needed.ARDUINO_USB_CDC_ON_BOOT: also selects IDF-native USB-Serial-JTAG. This is the hard-won fix from esp32c6 default env: Serial silently routed to UART0 instead of USB-Serial/JTAG → AutoResearch RPC unreachable on FH4 boards #2665/fl::print: minimal-surface contract — non-blocking on missing CDC host, USJ LL fallback on ESP32 USJ chips #2668 (classic ESP32-C6 default env silently routing Serial to UART0 instead of the actual USB-Serial-JTAG console).Serial. This is intentional, not accidental Arduino coupling — it preserves interop with a user sketch's ownSerial.print()calls sharing the same buffered object.Flipping this default unconditionally (my original sub-issue draft) would risk regressing the #2665/#2668 hardware bring-up work without the multi-chip hardware validation (classic ESP32 UART0-only, C3/C6 USB-Serial-JTAG, S3 USB-OTG-CDC) that would be needed to prove it safe — for a case that, on inspection, isn't actually broken.
No code change needed. Closing as already-satisfied; #3715 no longer lists this as required work.