Skip to content

feat(esp8266): qualify delayMicroseconds; document scope decision on the rest - #3731

Merged
zackees merged 1 commit into
masterfrom
feat/esp8266-remove-arduino-core
Jul 22, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/esp8266-remove-arduino-core

Conversation

@zackees

@zackees zackees commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

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

Change

Small, safe cleanup: clockless_esp8266.h and clockless_block_esp8266.h call unqualified delayMicroseconds(...) inside namespace fl { ... } — this already resolves to the fl:: facade via unqualified lookup (same situation as clockless_block_esp32.h before #3716), but is now explicit: fl::delayMicroseconds(...).

Scope decision (documented per the issue's own guidance)

#3723's acceptance criteria explicitly called for "a decision recorded... for UART1 + hardware-SPI: native registers or documented Arduino-only" rather than a rushed half-migration. After looking at each remaining item, here's the call:

  • fl::delayMicroseconds() still resolves to Arduino's ::delayMicroseconds() on ESP8266 (no ESP8266-specific platform_time file exists; it falls through to the generic platforms/arduino/platform_time.cpp.hpp). A native ets_delay_us()-based microsecond delay is plausible and safe, but ESP8266's millisecond-scale delay() needs software-watchdog-aware chunking to avoid resets — I can't validate that across delay durations without extensive on-device testing. Documented follow-up, not migrated.
  • pgmspace.h: NOT migrated. ESP8266 flash reads are memory-mapped and alignment-sensitive (see this file's own FL_ALIGN_PROGMEM comment) — exactly the kind of change that risks silent data corruption if gotten subtly wrong, and the existing Arduino implementation is the only one in this codebase that's actually hardware-validated. Kept Arduino-only.
  • fastspi_esp8266.h (<SPI.h>) and fastled_esp8266_uart.h (HardwareSerial Serial1): NOT migrated. Both are real protocol implementations with no existing native-SDK counterpart in this codebase to promote (unlike ESP32, which already had a complete fastspi_esp32_idf.h). A register-level rewrite is a real, separate effort deserving its own issue with dedicated hardware bring-up — not something to rush inside a low-priority sub-issue of a larger meta. Kept Arduino-only.

Test plan

Summary by CodeRabbit

  • Bug Fixes
    • Improved microsecond timing reliability for ESP8266 LED output and frame retry handling.
    • Preserved existing delay behavior while routing timing through the platform’s FastLED delay utility.

Explicitly qualifies the unqualified delayMicroseconds(...) calls in
clockless_esp8266.h and clockless_block_esp8266.h as fl::delayMicroseconds(...)
rather than relying on unqualified lookup inside namespace fl to find the
fl:: facade — same clarification already made on the ESP32 side in
#3716.

Scope decision for the rest of #3723 (documented per the issue's own
"take a deliberate decision, don't half-migrate" guidance):

- fl::delayMicroseconds() on ESP8266 still ultimately resolves to Arduino's
  ::delayMicroseconds() (via platforms/arduino/platform_time.cpp.hpp — ESP8266
  has no platform-specific time file). A genuine native replacement is
  possible (ets_delay_us() for the microsecond case), but ESP8266's
  millisecond-scale delay() needs software-watchdog-aware chunking that I
  can't fully validate without extensive on-device testing across delay
  durations; left as a documented follow-up rather than rushed.
- pgmspace.h (<pgmspace.h>, PROGMEM, pgm_read_*): NOT migrated. ESP8266
  flash-read semantics (memory-mapped, alignment-sensitive per this file's
  own FL_ALIGN_PROGMEM comment) are exactly the kind of change that risks
  silent data corruption if gotten wrong, and Arduino's implementation is
  the only one in this codebase that's actually been hardware-validated.
  Kept as Arduino-only.
- fastspi_esp8266.h (<SPI.h>) and fastled_esp8266_uart.h (HardwareSerial
  Serial1): NOT migrated. Both are real hardware protocol implementations
  with no existing native-SDK counterpart in this codebase (unlike ESP32,
  which already had a complete fastspi_esp32_idf.h to promote). Kept
  Arduino-only; a native register-level rewrite is a separate, larger
  effort that deserves its own issue with dedicated hardware bring-up.

Part of #3715. Closes #3723 (documented decision, partial migration).

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

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd71bcc6-7025-406c-aed6-d3befa689765

📥 Commits

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

📒 Files selected for processing (2)
  • src/platforms/esp/8266/clockless_block_esp8266.h
  • src/platforms/esp/8266/clockless_esp8266.h

📝 Walkthrough

Walkthrough

ESP8266 clockless output headers now include the FastLED delay utility and use fl::delayMicroseconds for retry waits, preserving existing timing values.

Changes

ESP8266 delay API qualification

Layer / File(s) Summary
Qualify ESP8266 retry delays
src/platforms/esp/8266/clockless_*
Both clockless implementations include fl/system/delay.h and replace unqualified delay calls with fl::delayMicroseconds.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3726 — Makes the corresponding namespaced delay update in another ESP clockless implementation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: qualifying delayMicroseconds in the ESP8266 code, with an accurate note about the remaining scope decision.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feat/esp8266-remove-arduino-core

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.

@zackees

zackees commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Local hardware compile note: attempted `bash compile esp8266 --examples Blink` against the real attached ESP8266 board (NodeMCU 0.9 / ESP-12, COM11). It fails with `fatal error: SPI.h: No such file or directory` in `fl/system/sd/fs_sdcard_arduino.cpp.hpp` — a completely unrelated SD-card subsystem, not anything touched by this PR.

Confirmed this is pre-existing, not caused by this PR: reproduces identically on a clean `master` checkout. Root cause is a local environment gap — this machine has never installed the framework-arduinoespressif8266 PlatformIO package (~/.platformio/packages/ has no ESP8266 Arduino framework or platform at all, only the bare xtensa-lx106 toolchain), so no <SPI.h> is discoverable anywhere for this board.

The compile did get through all 83 individual source files (including the two files this PR touches, clockless_esp8266.h/clockless_block_esp8266.h) before hitting the unrelated SD-card file — good evidence this PR's actual changes compile fine; I just can't produce a full linked firmware.bin for this board on this machine without a larger, out-of-scope framework install. Leaving that as a known gap rather than spending session time on an unrelated package install.

@zackees
zackees merged commit e78e21b into master Jul 22, 2026
11 checks passed
@zackees
zackees deleted the feat/esp8266-remove-arduino-core branch July 22, 2026 19:19
@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.

esp8266: migrate off Arduino core — pgmspace, SPI.h, HardwareSerial Serial1, delayMicroseconds

1 participant