Skip to content

fix(esp32c6): reject USB serial pins for LED output - #2681

Merged
zackees merged 1 commit into
masterfrom
fix/2677-esp32c6-usb-pins
Jun 2, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2677-esp32c6-usb-pins

Conversation

@zackees

@zackees zackees commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • mark ESP32-C6 GPIO12/GPIO13 invalid in the FastPin mask because they are native USB D-/D+
  • reject invalid output GPIOs in the PARLIO channel driver before configuring data_gpio_nums[]
  • make AutoResearch parlioStreamValidate fail channel creation before adding C6 pin maps that include GPIO12/GPIO13

Closes #2677

Validation

  • git diff --check
  • PLATFORMIO_SRC_DIR=$PWD\examples\AutoResearch pio run -e esp32c6
  • uploaded AutoResearch to ESP32-C6 on COM9
  • RPC hardware check on COM9: set TX base to GPIO0, ran parlioStreamValidate with 16 lanes/256 LEDs/2 iterations/1000 ms; result returned channelsOk=false, completed=false; follow-up status RPC succeeded and COM9 remained enumerated

Summary by CodeRabbit

  • Bug Fixes
    • Improved pin validation for PARLIO output pins to prevent invalid configurations.
    • Enhanced ESP32-C6 pin mask validation to properly exclude USB communication pins (GPIO12/13).
    • Added validation checks during initialization to warn and skip setup for invalid pins.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Three files add pin validation to prevent configuring GPIO12/13 as FastLED outputs on ESP32-C6, where these pins are native USB D-/D+ lines. The platform mask is updated with a compile-time assert, and runtime checks are added to PARLIO driver and AutoResearch streaming initialization.

Changes

ESP32-C6 USB GPIO Safety Validation

Layer / File(s) Summary
Pin mask definition and platform contract
src/platforms/esp/32/core/fastpin_esp32.h
ESP32-C6 FASTLED_UNUSABLE_PIN_MASK includes GPIO12/13 (USB D-/D+) and reserved GPIO24–26, GPIO28–30. Compile-time FL_STATIC_ASSERT enforces GPIO12/13 invalidity at build time.
PARLIO driver runtime pin validation
src/platforms/esp/32/drivers/parlio/channel_driver_parlio.cpp.hpp
New isValidParlioOutputPin() helper validates output pins against the 0–63 range and _FL_VALID_PIN_MASK bitmask. Invalid pins detected during ChannelDriverPARLIOImpl::beginTransmission trigger a warning and early return, skipping PARLIO engine configuration.
AutoResearch streaming pin validation
examples/AutoResearch/AutoResearchParlioStream.h
Per-lane channel setup in validateParlioStreaming(...) computes and validates tx_pin with isFastLedOutputPinValid(). Invalid pins clear FastLED channels and return early instead of proceeding with channel creation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • FastLED/FastLED#2562: Modifies examples/AutoResearch/AutoResearchParlioStream.h to introduce RPC-driven validator, while this PR adds FastLED output-pin validity checking within that same streaming setup.
  • FastLED/FastLED#2277: Changes the _FL_BIT/FASTLED_UNUSABLE_PIN_MASK macro setup in fastpin_esp32.h, impacting the mask infrastructure that this PR's output-pin validation relies on.
  • FastLED/FastLED#2276: Modifies fastpin_esp32.h's _FL_BIT macro guard and unusable-pin mask definition, overlapping directly with this PR's mask-definition logic.

Poem

🐰 A rabbit hops through GPIO lanes,
But twelve and thirteen? Clear restrains!
No USB D-/D+ confusion now,
ESP32-C6 validates how,
Safe streams flow, no power-cycling bow! 🔌✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title concisely and accurately describes the main change: rejecting USB serial pins (GPIO12/13 on ESP32-C6) for LED output.
Linked Issues check ✅ Passed All coding objectives from issue #2677 are met: ESP32-C6 mask updated for GPIO12/13, PARLIO runtime validation added, AutoResearch channel validation checks pins, and non-C6 targets remain unaffected.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the PR objective: adding USB pin validation in FastPin mask, PARLIO driver, and AutoResearch utilities—no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2677-esp32c6-usb-pins

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit 0255432 into master Jun 2, 2026
7 checks passed
@zackees
zackees deleted the fix/2677-esp32c6-usb-pins branch June 2, 2026 02:36
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(esp32c6): mark USB GPIO12/13 invalid for FastLED outputs

1 participant