Skip to content

fix(uart): wave10 minimum symbol separation — UART + SPI loopback GREEN (fixes #3572) - #3573

Merged
zackees merged 1 commit into
masterfrom
fix/uart-spi-channel-drivers-bench
Jul 2, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/uart-spi-channel-drivers-bench

Conversation

@zackees

@zackees zackees commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #3572.

Bench validation sweep on ESP32-WROOM COM11 (jumper GPIO33→34): all four channel drivers now pass byte-exact 10-LED loopback, 4/4 patterns each — RMT, I2S, UART, SPI.

UART — the one real bug

buildWave10Lut() best-fit rounding put WS2812B-V5's 1-symbol at 2 UART pulses (490 ns), only 245 ns above the 0-symbol — inside real WS281x parts' 0/1 sampling band and flapping the bench decoder's 500 ns threshold (wrong bytes / failed decodes, bench-captured H475/H500 flapping). Fix: enforce a 400 ns minimum absolute wire separation, widening T1H upward (longer HIGH still reads as 1): V5 → (1,3) = 245 vs 735 ns, matching the proven legacy WS2812 LUT shape. canRepresentTiming() mirrors the bump. Canonical WS2812 (1,3), SK6812 (1,4), and slow chipsets (WS2811-400 — 500 ns pulses already exceed the floor) are unchanged; unit test pins the V5 shape.

Bench after fix: {"driver":"UART","passed":true,"passedTests":4,"captureEvidenceBytes":120,"captureEvidenceRawEdges":256}

SPI — no code change needed

{"driver":"SPI","passed":true,"passedTests":4,...} on the same bench. Its earlier crashes were the #3571 heap-exhaustion family. The driver is already async at the channel level (spi_device_queue_trans ISR-driven DMA + non-blocking poll() pipeline); the remaining #3179 scope (ISR-chunked ring-buffer streaming) is a peak-memory optimization for very long strips, tracked separately.

Verification

  • bash test --cpp: green (incl. new Wave10 V5 separation test; WS2811-400/SK6812/WS2812 pinning tests unchanged).
  • bash lint: clean.
  • Bench regression: RMT 4/4, I2S 4/4, UART 4/4, SPI 4/4 — byte-exact.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved UART timing support for a WS2812B-V5-style profile, making closely spaced signal values more reliably distinguishable.
    • Updated the timing selection logic so valid signal patterns can be generated even when a small minimum separation is required.
  • Tests

    • Added coverage for the new timing profile to verify LUT generation, timing acceptance, and expected output patterns.

…back GREEN (#3572)

Bench validation sweep on ESP32-WROOM COM11 (jumper GPIO33->34), all
four channel drivers now pass byte-exact 10-LED loopback, 4/4 patterns:
RMT, I2S, UART, SPI.

UART (the one real bug, fixes #3572): buildWave10Lut best-fit rounding
put WS2812B-V5's 1-symbol at 2 pulses (490 ns) — only 245 ns above the
0-symbol, inside real WS281x parts' sampling-threshold band and
flapping the bench decoder's 500 ns threshold (wrong bytes / failed
decodes). Enforce a 400 ns minimum absolute wire separation, widening
T1H upward: V5 -> (1,3) = 245 vs 735 ns, matching the proven legacy
WS2812 LUT shape. canRepresentTiming mirrors the bump (T1H tolerance
widened by exactly the deliberate separation growth). Canonical WS2812
(1,3), SK6812 (1,4) and slow chipsets (WS2811-400, 500 ns pulses)
unchanged. New unit test pins the V5 (1,3) shape.

SPI needed no code change — its earlier bench crashes were the #3571
heap-exhaustion family. The driver is already async at the channel
level (spi_device_queue_trans ISR-driven DMA + non-blocking poll());
the remaining #3179 scope (ISR-chunked ring-buffer streaming) is a
peak-memory optimization, unchanged by this PR.

Co-Authored-By: Claude Fable 5 <[email protected]>
@zackees
zackees merged commit 6644120 into master Jul 2, 2026
10 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a6760b4-5964-46ec-ba3f-8afd6090947b

📥 Commits

Reviewing files that changed from the base of the PR and between 933a0f4 and ae61088.

📒 Files selected for processing (2)
  • src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp
  • tests/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp

📝 Walkthrough

Walkthrough

Modifies buildWave10Lut and canRepresentTiming in the ESP32 UART wave8 encoder to enforce a minimum 400 ns wire separation between quantized 0 and 1 symbol timings by biasing the pulse count for the 1-symbol upward when needed, and adds a corresponding test case.

Changes

Wave10 LUT minimum separation enforcement

Layer / File(s) Summary
LUT generation and feasibility bump
src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp
buildWave10Lut increments pulses_1 (capped at 4) until quantized separation from pulses_0 reaches 400 ns; canRepresentTiming mirrors this bump and widens T1H tolerance accordingly.
Separation test for WS2812B-V5
tests/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp
New test verifies canRepresentTiming succeeds, checks per-half HIGH pulse counts for "00"/"11" LUT entries, and validates the LUT bytes match the legacy WS2812 pattern.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

Not applicable — the changes are localized numeric/logic adjustments within a single component rather than a multi-component interaction flow.

✨ 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 fix/uart-spi-channel-drivers-bench

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.

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.

UART clockless driver: wave10 quantization puts WS2812B-V5 1-symbol inside the 0/1 ambiguity band (bench decode failures)

1 participant