Skip to content

feat(esp8266): fl::RxChannel via the I2S RX hardware receiver (#4945) - #4958

Merged
zackees merged 1 commit into
masterfrom
feat/4945-esp8266-rx
Oct 28, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/4945-esp8266-rx

Conversation

@zackees

@zackees zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member

Fixes #4945. Part of #4949.

Problem

ESP8266 had no fl::RxChannel backend — every backend (gpio_isr_rx, i2s_rx, parlio_rx, rmt_rx) lives under esp/32/drivers/, and the AutoResearch benches hand-rolled a GPIO poll instead.

Design note (why I2S RX, not GPIO ISR)

The hand-rolled capture (AutoResearchEsp8266.h::captureEdges) is a synchronous IRAM rsr ccount poll that also feeds the UART1 TX FIFO — it's welded to the TX it measures and can't be a generic async device. A real per-edge GPIO ISR is also not feasible: ~1 µs interrupt latency ≫ the ~350 ns WS2812 T0H. So the one usable hardware receiver is the I2S RX path.

Change

  • rx_device_i2s_rx.{h,cpp.hpp} (new) — Esp8266I2sRxDevice implements the full RxDevice interface over the core's verified core_esp8266_i2s.h (i2s_rxtxdrive_begin RX-only, i2s_set_rate(kI2sSlotHz), i2s_read_sample). It captures 16-bit samples at the WS2812 slot rate (the same rate the ESP8266: I2S output engine (clockless/parallel via the I2S peripheral) #4943 I2S engine emits), reconstructs the slot-level bit stream, converts runs to EdgeTime, and decodes via the shared decodeWs2812Edges path — so the I2S output engine is validated by looping its output back into I2S RX. samplesToEdges is pure math (host-testable).
  • rx.cpp.hpp — ESP8266 branch in the RxDevice factory: RxBackend::I2S_RX + PLATFORM_DEFAULT → the I2S RX device; ISR/RMT/FLEXPWM/FLEXIO/PARLIO_RX/LPC_SCT_CAPTURE → DummyRxDevice with a clear message.
  • _build.cpp.hpp — the device TU joins the ESP8266 unity build.

Test plan / evidence

  • bash compile esp8266 --examples Blink,Esp8266Uart → both succeed; images unchanged from master (264,671 / 264,199 B) — the RX device dead-strips when unused.
  • ci/lint.py --strict clean (SpanFromPointer/Stdint fixed).
  • Remaining (needs a board): on-device I2S TX→RX loopback capture + decode; the sample→edge reconstruction is pure math and host-testable.

ESP8266 had no RxChannel backend -- every backend was ESP32-only and the
AutoResearch benches hand-rolled a GPIO poll instead. Add the one hardware
receiver the ESP8266 actually has: the I2S peripheral's RX path.

- rx_device_i2s_rx.{h,cpp.hpp} (new): Esp8266I2sRxDevice implements the full
  RxDevice interface over the core's verified core_esp8266_i2s.h
  (i2s_rxtxdrive_begin RX-only, i2s_set_rate(kI2sSlotHz), i2s_read_sample).
  It captures 16-bit samples at the WS2812 slot rate (the same rate the #4943
  I2S engine emits), reconstructs the slot-level bit stream, converts runs to
  EdgeTime, and decodes via the shared decodeWs2812Edges path -- so the I2S
  output engine can be validated by looping its output back into I2S RX.
  samplesToEdges is pure math (host-testable).
- rx.cpp.hpp: an ESP8266 branch in the RxDevice factory. RxBackend::I2S_RX and
  PLATFORM_DEFAULT map to the I2S RX device; ISR returns a DummyRxDevice with
  an explanatory message (a per-edge GPIO ISR is not feasible: ~1 us latency
  vs a ~350 ns T0H -- which is exactly why the bench used a synchronous poll).
- _build.cpp.hpp: the device TU joins the ESP8266 unity build.

Verified: bash compile esp8266 --examples Blink,Esp8266Uart both succeed; the
images are unchanged from master (264,671 / 264,199 B) -- the RX device
dead-strips when unused. On-device I2S loopback capture is the remaining
acceptance step (needs a board); the sample->edge reconstruction is host-
testable.

Refs #4945, #4949.
@zackees
zackees merged commit 17a5b8f into master Oct 28, 2026
78 of 80 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 28, 2026
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Memory usage (this PR vs. its merge base)

Change in examples/Blink per target. The left number is this PR's image flash / attributed RAM in bytes; the colored delta is the change from the merge base (red is larger, green is smaller or unchanged).

Target FLASH [bytes] RAM [bytes]
attiny85 2,460 (🟢 0) 136 (🟢 0)
esp8266 264,667 (🟢 -4) 6,808 (🟢 0)

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: fl::RxChannel input driver (GPIO-ISR) — none exists

1 participant