fix(platforms): drop toxic ARDUINO_USB_CDC_ON_BOOT / USB_MODE flags#11
Conversation
With ARDUINO_USB_CDC_ON_BOOT=1 the Arduino-ESP32 core routes Serial to the USB-CDC interface, which only enumerates when a USB host is connected. Boards powered from a wall adapter then hang in setup() the moment user code touches Serial. This is exactly the failure mode a starter repo must not ship with — users copy these envs as their starting point, and the fixture works on the bench but stops working in deployment. Drop the flag (and the related ARDUINO_USB_MODE=1) from every env that was carrying it: - esp32c6: remove both flags from build_flags - esp32p4: remove ARDUINO_USB_MODE=1 (originally added per issue #9 spec) - esp32c3: remove the explicit =0 stanza; default is already safe and the surrounding comment had the two states reversed Each affected ini gets a short "Do NOT add" comment so the flag doesn't silently come back. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughUSB CDC compile-time build flags ( ChangesUSB CDC Flag Removal
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
✨ Finishing Touches🧪 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
Drop
-DARDUINO_USB_CDC_ON_BOOT=1and-DARDUINO_USB_MODE=1from the ESP32 board envs that were carrying them.esp32c6: removed both flags frombuild_flagsesp32p4: removedARDUINO_USB_MODE=1(originally added per the Add ESP32 PARLIO-capable boards (C5, C6, H2, P4) with required ISR-IRAM flags #9 spec)esp32c3: removed the explicit=0stanza — default is already safe, and the surrounding comment had the two states reversedEach affected ini also gets a short "Do NOT add" comment so the flag doesn't silently come back in future PRs.
Why this matters
With
ARDUINO_USB_CDC_ON_BOOT=1, the Arduino-ESP32 core routesSerialto the USB-CDC interface, which only enumerates when a USB host is connected. Boards powered from a wall adapter then hang insetup()the moment user code touchesSerial.This is exactly the failure mode a starter repo must not ship with: users copy these envs as their starting point, the fixture works on the bench (plugged into a PC), and then stops working the moment they deploy it on a wall adapter.
Test plan
pio run -c platforms/platformio.esp32c3.inistill succeedspio run -c platforms/platformio.esp32c6.inistill succeedspio run -c platforms/platformio.esp32p4.inistill succeedsSerial.begin(115200); Serial.println("hi");insetup()now boots on a wall adapter (no host connected)🤖 Generated with Claude Code
Summary by CodeRabbit