Skip to content

test(esp8266): prove the I2S TX->RX capture loopback in software (#4945) - #4959

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

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

Conversation

@zackees

@zackees zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member

Follow-up to #4958 (#4945): proves the new ESP8266 RX capture end-to-end, and fixes a bug doing so.

What this adds

A host test that takes the I2S output engine's encode (what #4943 emits) → the RX reconstruction samplesToEdges (the shared function Esp8266I2sRxDevice uses) → the shared decodeWs2812Edges, and checks full frames round-trip — single bytes, boundary bytes (0x00/0xFF/0xAA/0x55/0x0F/0xF0/0x01/0x80) and a 9-byte multi-LED frame. That is the TX→RX loopback, verified without hardware.

Bug this caught (now fixed)

samplesToEdges walked sampleCount * kI2sBitsPerSample slots (4/sample) instead of 16 slots/sample, so it only read the top nibble — the loopback failed until corrected. It's the kind of off-by-N the hardware path would have hidden.

Refactor

samplesToEdges moves into i2s_ws2812_codec.h as a free, host-testable function; Esp8266I2sRxDevice delegates to it (no duplication).

Test plan / evidence

  • bash test i2s_ws2812_codec → all pass (codec + TX→RX loopback cases).
  • bash compile esp8266 --examples Blink → succeeds.
  • ci/lint.py --strict clean (test folded into its matching source per TestPathStructureChecker).

Software proof of the #4945 RX capture: the I2S WS2812 codec's encode (what the
#4943 engine emits) -> samplesToEdges (the shared RX reconstruction
Esp8266I2sRxDevice uses) -> decodeWs2812Edges round-trips full frames, no
hardware.

- samplesToEdges moves into i2s_ws2812_codec.h as a free, host-testable function;
  the RX device delegates to it (no duplication).
- FIX the bug the test caught: samplesToEdges walked sampleCount *
  kI2sBitsPerSample slots (4/sample) instead of 16 slots/sample, reading only the
  top nibble -- the loopback only round-tripped once corrected.
- Extend tests/platforms/esp/8266/i2s_ws2812_codec.cpp (its matching source) with
  boundary-byte and 9-byte multi-LED round-trips plus a run-length case.

Verified: bash test i2s_ws2812_codec -> all pass; bash compile esp8266 --examples
Blink succeeds; ci/lint.py --strict clean.

Refs #4945, #4943, #4949.
@zackees
zackees merged commit c260d1a into master Oct 28, 2026
95 of 97 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 (🟢 0) 6,808 (🟢 0)

@zackees
zackees deleted the feat/4945-rx-loopback branch November 5, 2026 05:52
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.

1 participant