Repository navigation
feat(esp8266): qualify delayMicroseconds; document scope decision on the rest - #3731
Conversation
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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughESP8266 clockless output headers now include the FastLED delay utility and use ChangesESP8266 delay API qualification
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
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 The compile did get through all 83 individual source files (including the two files this PR touches, |
Closes #3723. Part of meta #3715 (ESP Arduino-decoupling).
Change
Small, safe cleanup:
clockless_esp8266.handclockless_block_esp8266.hcall unqualifieddelayMicroseconds(...)insidenamespace fl { ... }— this already resolves to thefl::facade via unqualified lookup (same situation asclockless_block_esp32.hbefore #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-specificplatform_timefile exists; it falls through to the genericplatforms/arduino/platform_time.cpp.hpp). A nativeets_delay_us()-based microsecond delay is plausible and safe, but ESP8266's millisecond-scaledelay()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 ownFL_ALIGN_PROGMEMcomment) — 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>) andfastled_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 completefastspi_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
bash lint --cpp— cleanbash test --cpp— 355/355 passbash compile esp8266 --examples Blink— real ESP8266 hardware attached (NodeMCU 0.9 / ESP-12) at COM11; validating separately due to fbuild daemon lock contention with other concurrent Meta: decouple src/platforms/esp from the Arduino core — go straight to Espressif (ESP-IDF) headers, with IDF 3.x-6.x compat + per-IDF compile-test CI #3715 sub-issue builds, will follow up with results as a PR comment.Summary by CodeRabbit