Repository navigation
feat(esp32): bare-IDF fl::platforms time implementation - #3726
Conversation
platform_time_esp32.cpp.hpp was gated on defined(ARDUINO), so a bare
ESP-IDF build had no fl::platforms::{millis,micros,delayMicroseconds}
implementation at all — a link failure. Replace the Arduino global calls
with ESP-IDF native equivalents (esp_timer_get_time, esp_rom_delay_us /
ets_delay_us per the ESP_IDF_VERSION_4_OR_HIGHER predicate, matching the
existing watchdog_esp32_idf4.hpp convention) and drop the ARDUINO gate so
the same code path serves both Arduino-ESP32 and bare ESP-IDF builds.
Also qualifies the delayMicroseconds() call in clockless_block_esp32.h as
fl::delayMicroseconds() explicitly rather than relying on unqualified
lookup finding the fl:: facade.
Part of #3715. Closes #3716.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Warning Review limit reached
Next review available in: 7 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)
📝 WalkthroughWalkthroughESP32 platform timing now uses ESP-IDF APIs without requiring Arduino, including version-specific microsecond delays and ChangesESP32 timing support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platforms/esp/32/platform_time_esp32.cpp.hpp`:
- Around line 13-28: Add the ESP-IDF components required by the includes in
platform_time_esp32.cpp.hpp to the existing CMakeLists.txt dependency
declaration: include the component providing esp_timer and the component
required by esp_rom_sys.h, while preserving the current Arduino, I2S, MCPWM, and
RMT dependencies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 084f4ef8-750d-4266-8176-15b237884ce9
📒 Files selected for processing (2)
src/platforms/esp/32/clockless_block_esp32.hsrc/platforms/esp/32/platform_time_esp32.cpp.hpp
platform_time_esp32.cpp.hpp now includes esp_timer.h (esp_timer_get_time) and esp_rom_sys.h/rom/ets_sys.h (esp_rom_delay_us/ets_delay_us) — declare the owning ESP-IDF components so the idf_component_register() dependency graph is accurate for component-based (bare-IDF) builds. Addresses CodeRabbit review on #3726. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CMakeLists.txt`:
- Line 17: Update the component requirements near app_update to preserve ESP-IDF
3.x resolution: remove unconditional esp_timer and esp_rom dependencies, or
conditionally require them only for IDF 4 and newer. Keep legacy IDF 3.3 builds
using rom/ets_sys.h resolvable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d210d5f6-edbb-41a8-9e9e-b4001cedaef6
📒 Files selected for processing (1)
CMakeLists.txt
esp_rom is a standalone ESP-IDF component only from 4.x onward (esp_rom_sys.h / esp_rom_delay_us). Requiring it unconditionally would break component resolution on IDF 3.x, where platform_time_esp32.cpp.hpp uses rom/ets_sys.h (ets_delay_us) instead — no separate component needed there. Addresses CodeRabbit re-review on #3726. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Closes #3716. Part of meta #3715 (ESP Arduino-decoupling).
Problem
platform_time_esp32.cpp.hppimplementsfl::platforms::{delay,delayMicroseconds,millis,micros}for ESP32, but the whole file was gated ondefined(ARDUINO), and internally called Arduino globals (::millis(),::micros(),::delayMicroseconds()). A bare ESP-IDF build (framework=espidf, no Arduino core) has no time implementation at all for these symbols — a link failure. This is the hard blocker for any bare-IDF FastLED build.Fix
::millis()/::micros()withesp_timer_get_time().::delayMicroseconds()'s remainder busy-wait withesp_rom_delay_us()(IDF 4.0+) /ets_delay_us()(IDF 3.x), gated on the existingESP_IDF_VERSION_4_OR_HIGHERpredicate fromesp_version.h— same pattern already used inwatchdog_esp32_idf4.hpp.defined(ARDUINO)condition entirely; the file now compiles identically under Arduino-ESP32 (which bundles ESP-IDF) and bare ESP-IDF.clockless_block_esp32.h:90's unqualifieddelayMicroseconds(...)call is now explicitly qualified asfl::delayMicroseconds(...)for clarity (it already resolved to thefl::facade via unqualified lookup insidenamespace fl, sincefl::delayMicrosecondsforwards tofl::platforms::delayMicroseconds— this makes that intent unambiguous).Test plan
bash test --cpp— 355/355 host tests passbash lint --cpp— cleanbash compile esp32dev --examples Blink— real Arduino-ESP32 3.3.7 (IDF 5.x) build succeeds and links, exercising the newesp_timer_get_time()/esp_rom_delay_us()code path (flash 382KB, ram 143KB — matches prior baseline)framework=espidf(no Arduino) compile-test — no CI leg exists yet; tracked by ci: bare-IDF (framework=espidf) compile-test legs for IDF 4.4 / 5.x / 6.x (+ FL_NO_ARDUINO ratchet) #3724. This PR is a prerequisite for that leg to pass.Summary by CodeRabbit
Bug Fixes
millis()/micros()and delay behavior for more accurate timing, including interrupt-safe microsecond waits.Chores