Skip to content

change -C5 and -C6 builds to use USB-CDC - #5944

Merged
softhack007 merged 1 commit into
mainfrom
USBCDC_for_C5_C6
Nov 4, 2026
Merged

softhack007 merged 1 commit into
mainfrom
USBCDC_for_C5_C6

Conversation

@softhack007

@softhack007 softhack007 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member
  • change the build settings from UART-to-USB to USB-CDC (all devkits have CDC, but some cheap boards don't have UART-to-USB)
  • some debug help to print the USB config when compiling with WLED_DEBUG
  • ensure that ARDUINO_USB_MODE is set on C5 builds
  • P4 buildenv comments updated

still needs some testing, to confirm that boards will finish booting when not connected to a PC by USB

Summary by CodeRabbit

  • Improvements
    • ESP32-C5 and 8 MB ESP32-C6 boards now start with virtual USB CDC enabled, changing the USB connection type available at boot.
    • ESP32-C5 builds now set the required USB mode automatically. ESP32-C6 retains its USB mode setting.
    • Board descriptions clarify USB connection options for ESP32-C5, ESP32-C6, and ESP32-P4, and update PSRAM details.
    • Debug builds now warn about USB startup and mode settings, including when USB DFU or USB MSC is enabled.

* change the build settings from UART-to-USB to USB-CDC (all devkits have CDC, but some cheap boards don't have UART-to-USB)
* some debug help to print the USB config when compiling with WLED_DEBUG
* ensure that ARDUINO_USB_MODE is set on C5 builds
*  P4 buildenv comments updated

still needs some testing, to confirm that boards will finish booting when not connected to a PC by USB
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between fce41f2 and 0edda0f.

Files selected for processing: 2
  • platformio.ini
  • wled00/wled_main.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Recent review details
Additional context used
Code guidelines: 3
docs/cpp.instructions.md — configured
AGENTS.md — configured
CONTRIBUTING.md — auto-discovered
Path-based instructions: 6
Apply the WLED security hardening rules from docs/hardening.instructions.md, and consult docs/securecode.instructions.md when more details are needed for actionable recommendations.

CodeRabbit configuration file

Files:

  • wled00/wled_main.cpp
Scan for secrets, passwords, and other sensitive information accidentally committed to PlatformIO configuration files (platformio.ini, platformio_override.ini, platformio_override.ini.sample).

CodeRabbit configuration file

Files:

  • platformio.ini
Follow the C++ coding conventions documented in docs/cpp.instructions.md and the general project guidelines in AGENTS.md and .github/copilot-instructions.md.

CodeRabbit configuration file

Files:

  • wled00/wled_main.cpp
Applicability reference: AGENTS.md: # AGENTS.md — WLED AI Coding Agent & AI Code Review Reference See also: `.github/copilot-instructions.md`, `.github/agent-build.instructions.md`, `docs/cpp.instructions.md`, `docs/web.in...

CodeRabbit inference engine (docs/cpp.instructions.md)

Files:

  • wled00/wled_main.cpp
Source excerpt: Follow the existing style in the file you are editing Source excerpt: Avoid unexplained "magic numbers".

CodeRabbit inference engine (AGENTS.md)

Files:

  • wled00/wled_main.cpp
Applicability reference: AGENTS.md: # AGENTS.md — WLED AI Coding Agent & AI Code Review Reference Reviewer time is limited, and checking long AI-generated explanations for reasoning errors and hallucinations is costly.

CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • wled00/wled_main.cpp
  • platformio.ini
Additional comments: 4
platformio.ini: 3

440-441: LGTM!

Also applies to: 468-468, 515-515, 542-542, 554-554, 573-573, 596-596, 620-620

440-441: Maintainability & Code Quality

The comment asserts a repository requirement for maintainer approval of platformio.ini changes. The inspected conventions, path instructions, and learnings do not contain that requirement. The finding is an unsupported process request, not a code defect.

529-530: Stability & Availability

The requested board testing may be useful, but the supplied evidence does not establish a stability or availability defect or a violated repository requirement. This is a validation recommendation, not an actionable review finding.

wled00/wled_main.cpp: 1

18-37: LGTM!

Walkthrough

ESP32-C5 and ESP32-C6 environments now select virtual USB CDC at boot. The build settings and environment descriptions identify USB modes and update some PSRAM details. Debug builds also warn about selected USB-related macro values.

Changes

ESP32 USB build configuration

Layer / File(s) Summary
USB settings and environment descriptions
platformio.ini
C5 and C6 environments enable virtual USB CDC at boot and retain serial-to-USB CDC as a commented option. C5 sets its mandatory USB mode in shared build flags. Environment descriptions identify USB connection details; the P4 16 MB description updates its PSRAM wording.
Debug USB macro warnings
wled00/wled_main.cpp
Under WLED_DEBUG, preprocessor warnings report defined CDC-on-boot and USB-mode values, and enabled DFU-on-boot or MSC-on-boot settings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

  • wled/WLED#5943: Adds an ESP32-C6 environment that explicitly enables USB CDC on boot, related to the C6 USB configuration changes.

Suggested labels: enhancement

Suggested reviewers: dedehai, netmindz

Merge Risk: Minimal · up to 0edda

C5 and C6 builds now use native USB CDC for serial communication. No merge-blocking failure is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: C5 and C6 builds now use USB-CDC.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

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.

Share

coderabbitai[bot]

This comment was marked as low quality.

@softhack007

softhack007 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member Author

ok, quick tests on my C5 and C6 "devKit" boards look good.

@DedeHai or @willmmiles I only have devkits - please give this PR a spin on a board without the second "UART-to-USB" connector. Quick checklist:

  • flash with a USB-CDC build
  • board boots when connected to a computer. sending "v" over serial monitor returns the WLED version
  • effects continue to run when closing VSCode (disconnecting should not cause WLED to stall on Serial output)
  • board boots without USB debug connection, for example when powered by a USB battery pack. LED effects start normally.

@softhack007

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

@DedeHai

DedeHai commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

I do not have a board with both ports - the Arduino USB mode is still a bit of a mystery to me... on the S3 if it is set wrong, it won't boot as it waits for JTAG - until you open a serial port.
I can check which configs I use for C5 and C6 later.

@netmindz

netmindz commented Nov 3, 2026

Copy link
Copy Markdown
Member

Ah this lovely joy! I'm not sure if we can get both CDC and not hanging on boot without serial connected using build flags alone. I really struggled with the Adafruit S3 matrix portal. I think we might possibly need to change the code as well that blocks until the serial goes ready. It's a long time back and maybe V5 had better options for this than V4.

I think I did see a PR for the esp web tools that were looking to supply the right image for CDC Vs UART, if we do need to have two build variants

@softhack007
softhack007 merged commit 9a073e5 into main Nov 4, 2026
70 checks passed
@softhack007

Copy link
Copy Markdown
Member Author

seems to work => merging

@Cellivar

Cellivar commented Nov 5, 2026

Copy link
Copy Markdown

Realizing you're not asking for feedback here, but a few hours before you merged this in I managed to compile and shove the esp32c6dev_4MB onto a ESP32-C6 Super Mini and it's doing great driving 30 addressable LEDs. I was also able to OTA an update to include the battery usermod. I appreciate the huge amount of work y'all are doing here, thank you!

@softhack007
softhack007 deleted the USBCDC_for_C5_C6 branch November 5, 2026 10:40
spectrumjade added a commit to spectrumjade/WLED that referenced this pull request Nov 12, 2026
esp32c6dev_4MB now enables USB CDC on boot itself (wled#5944).

Co-Authored-By: Claude Opus 5.5 (Claude Code) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants