Repository navigation
feat(esp32): CLED begin() uses IDF driver/ledc.h instead of Arduino LEDC - #3733
Conversation
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]>
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Closes #3719. Part of meta #3715 (ESP Arduino-decoupling).
Problem
CLED::begin()unconditionally called Arduino'sledcAttach/ledcAttachPin/ledcSetup(forked onESP_ARDUINO_VERSION_MAJORfor the Core 2.x vs 3.x API change), even thoughwrite16()already had a working IDF-native path (ledc_set_duty/ledc_update_duty) gated onFL_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 usesledc_timer_config()/ledc_channel_config()directly whendriver/ledc.his available (true under both Arduino-ESP32 and bare ESP-IDF), using the samechannel/8→ speed-mode-group,channel%8→ timer mapping thatwrite16()already assumes. The ArduinoledcAttach/ledcSetuppath is now a true last-resort fallback for toolchains that lackdriver/ledc.hentirely.Test plan
bash lint --cpp— cleanbash compile esp32dev --examples Blink— real Arduino-ESP32 3.3.7 (IDF 5.x) build compiles and linkscled.cpp.hpp(it's part of the ESP32 unity build; flash 391611 bytes, ram 146345 bytes — matches the esp32: bare-IDF fl::platforms time impl — drop Arduino millis()/micros()/delayMicroseconds() (blocks all framework=espidf builds) #3716/esp32: remove <esp32-hal.h> Arduino fallbacks from clock_cycles.h (+ rmt4 driver cascade) #3717 baseline)begin()/write16()at runtime.