Skip to content

feat(esp32): CLED begin() uses IDF driver/ledc.h instead of Arduino LEDC - #3733

Merged
zackees merged 1 commit into
masterfrom
feat/esp32-cled-idf-ledc
Jul 22, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/esp32-cled-idf-ledc

Conversation

@zackees

@zackees zackees commented Jul 22, 2026

Copy link
Copy Markdown
Member

Closes #3719. Part of meta #3715 (ESP Arduino-decoupling).

Problem

CLED::begin() unconditionally called Arduino's ledcAttach/ledcAttachPin/ledcSetup (forked on ESP_ARDUINO_VERSION_MAJOR for the Core 2.x vs 3.x API change), even though write16() already had a working IDF-native path (ledc_set_duty/ledc_update_duty) gated on FL_CLED_HAS_LEDC. This meant CLED could never initialize under a bare ESP-IDF build even though its per-frame write path would have worked.

Fix

begin() now uses ledc_timer_config()/ledc_channel_config() directly when driver/ledc.h is available (true under both Arduino-ESP32 and bare ESP-IDF), using the same channel/8 → speed-mode-group, channel%8 → timer mapping that write16() already assumes. The Arduino ledcAttach/ledcSetup path is now a true last-resort fallback for toolchains that lack driver/ledc.h entirely.

Test plan

CLED::begin() unconditionally called Arduino's ledcAttach/ledcAttachPin/
ledcSetup (forked on ESP_ARDUINO_VERSION_MAJOR for the Core 2.x vs 3.x API
change), even though write16() already had a working IDF-native path
(ledc_set_duty/ledc_update_duty) gated on FL_CLED_HAS_LEDC. This meant
CLED could never initialize under a bare ESP-IDF build even though its
per-frame write path would have worked.

begin() now uses ledc_timer_config()/ledc_channel_config() directly when
driver/ledc.h is available (true under Arduino-ESP32 and bare ESP-IDF
alike), using the same channel/8 => speed-mode-group, channel%8 => timer
mapping that write16() already assumes. The Arduino ledcAttach/ledcSetup
path is now a true last-resort fallback for toolchains that lack
driver/ledc.h entirely.

Part of #3715. Closes #3719.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92d75481-a884-429e-bd87-14d7b2580b8e

📥 Commits

Reviewing files that changed from the base of the PR and between 1404736 and 7bdc7d9.

📒 Files selected for processing (1)
  • src/platforms/esp/32/drivers/cled.cpp.hpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/esp32-cled-idf-ledc

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.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 22, 2026
@zackees
zackees merged commit 35c685f into master Jul 22, 2026
10 checks passed
@zackees
zackees deleted the feat/esp32-cled-idf-ledc branch July 22, 2026 19:28
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 22, 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.

esp32: cled.cpp.hpp — replace Arduino ledcAttach/ledcSetup/ledcWrite with IDF driver/ledc.h

1 participant