Skip to content

esp32: bare-IDF fl::platforms time impl — drop Arduino millis()/micros()/delayMicroseconds() (blocks all framework=espidf builds) #3716

Closed

Description

@zackees

Part of #3715.

Problem

fl::platforms::{delay, delayMicroseconds, millis, micros} for ESP32 is implemented only in src/platforms/esp/32/platform_time_esp32.cpp.hpp, and the whole file is gated:

#if defined(FL_IS_ESP32) && defined(ARDUINO) && !defined(FASTLED_STUB_IMPL)   // line 11

Inside, it calls Arduino globals: ::delayMicroseconds() (line 39), ::millis() (line 44), ::micros() (line 48). The generic fallback src/platforms/arduino/platform_time.cpp.hpp is also gated on defined(ARDUINO) (and excludes FL_IS_ESP32 anyway).

Consequence: a bare ESP-IDF build has no time implementation at all — fl::platforms::millis etc. are undefined symbols at link time. This is the single hardest blocker for any framework=espidf build and must land before the CI sub-issue can go green.

Additional stray Arduino call: src/platforms/esp/32/clockless_block_esp32.h:90 calls unqualified delayMicroseconds(...).

Fix

Replace the Arduino calls with IDF-native equivalents so the impl compiles under both Arduino and bare IDF, and drop the defined(ARDUINO) term from the guard:

Arduino IDF-native
::millis() esp_timer_get_time() / 1000
::micros() esp_timer_get_time()
::delayMicroseconds(us) esp_rom_delay_us(us) (IDF 4+) / ets_delay_us(us) (IDF 3.x)
::delay(ms) already vTaskDelay(pdMS_TO_TICKS(ms)) — keep (FreeRTOS, framework-agnostic)

The existing ms/us split in delayMicroseconds (yield via vTaskDelay for whole ms, busy-wait the remainder) should be preserved.

clockless_block_esp32.h:90 → route through fl::platforms::delayMicroseconds (or esp_rom_delay_us directly).

IDF compat notes (3.x/4.x/5.x/6.x)

  • esp_timer_get_time() exists in IDF 3.x+ (esp_timer.h); on 3.x the header lives at the same include path — verify against the esp32dev_idf33 CI leg.
  • esp_rom_delay_us was introduced with the esp_rom_* layer in IDF 4; use ets_delay_us (declared in rom/ets_sys.h on 3.x/4.x, esp_rom_sys.h on 4.3+) behind the esp_version.h predicates.
  • Follow the existing version-fork convention (isr_esp32_idf{3,4,5}.hpp) if a clean single expression is not possible.

Acceptance criteria

Activity

  1. added
    type: feature
    priority: high
    platform: esp32
    area: core
    on Jul 22, 2026
  2. moved this from Triage to Done in FastLED Trackeron Jul 22, 2026
  3. added a commit that references this issue on Jul 22, 2026
    eabb9b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreplatform: esp32priority: hightype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions