Skip to content

test(channels): widen wave8 LUT regression matrix to real chipset timings (refs #3023) - #3028

Merged
zackees merged 1 commit into
masterfrom
feat/wave8-cross-driver-test
Jun 14, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/wave8-cross-driver-test

Conversation

@zackees

@zackees zackees commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds three host test cases to tests/fl/channels/wave8.cpp that walk a
representative set of real chipset timings (WS2812, WS2812B-V5, WS2813,
SK6812, UCS1903B, TM1809, PL9823, WS2811, WS2815, UCS1903_400KHZ):

  1. Path equivalence: buildWave8ByteExpansionLUT is bit-identical
    to the nibble-LUT path for all 256 possible input bytes, at every
    timing. (Existing test only covered one synthetic timing — this
    widens the matrix to the real timings the project actually ships.)

  2. Wave8 framing invariant: every bit cell starts with a HIGH pulse
    and ends with a LOW pulse — for both the all-ones (0xFF) and
    all-zeros (0x00) input bytes. This is the wire shape that
    Bus::LPUART::canHandle() will rest on ([meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 workstream A);
    encoding it here pins the assumption before the LPUART driver lands
    so a future timing-table edit can't quietly invalidate it.

  3. Transposition equivalence: wave8Transpose_4 produces identical
    output whether driven from the nibble LUT or the byte LUT.

Catches LUT-rebuild regressions in src/fl/channels/wave8.cpp.hpp that
only manifest at a particular chipset's bit distribution — the issue
author's stated "highest-ROI test we don't have today."

This is workstream B of the #3023 meta issue, scaled down to focus on
the LUT-correctness regression target without diving into per-driver
mock APIs (the per-driver byte-stream comparison piece is deferred to a
follow-up PR that depends on workstream C's shared streaming-ISR mock
fixture).

Test plan

  • fl_channels_wave8 passes (1/1) — verified locally with all
    three new test cases compiling and running green.
  • No new files created (appended to existing test file, paired with
    src/fl/channels/wave8.h).
  • Test runs in well under a second — pure LUT math, no hardware
    mocks involved.

Refs #3023

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests
    • Added comprehensive regression test suite for wave8 cross-driver functionality, validating LUT expansion consistency, bit-cell framing invariants across chipsets, and transpose operation correctness with different lookup table configurations.

…ings

Adds three host test cases to `tests/fl/channels/wave8.cpp` that walk a
representative set of real chipset timings (WS2812, WS2812B-V5, WS2813,
SK6812, UCS1903B, TM1809, PL9823, WS2811, WS2815, UCS1903_400KHZ):

  1. Path equivalence: `buildWave8ByteExpansionLUT` is bit-identical to
     the nibble-LUT expansion path for all 256 possible input bytes, at
     every timing. (Existing test only covered one synthetic timing.)

  2. Wave8 framing invariant: every bit cell starts with a HIGH pulse
     and ends with a LOW pulse — for both the all-ones (0xFF) and
     all-zeros (0x00) input bytes. This is the wire shape that
     `Bus::LPUART::canHandle()` will rest on (issue #3023 workstream A);
     encoding it here pins the assumption before the LPUART driver lands
     so a future timing-table edit can't quietly invalidate it.

  3. Transposition equivalence: `wave8Transpose_4` produces identical
     output whether driven from the nibble LUT or the byte LUT.

Catches LUT-rebuild regressions in `src/fl/channels/wave8.cpp.hpp` that
only manifest at a particular chipset's bit distribution — the issue
author's stated "highest-ROI test we don't have today."

Refs #3023

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds 145 lines of regression tests to tests/fl/channels/wave8.cpp for issue #3023. A makeRealTiming template and RealTimingEntry struct are introduced to build concrete chipset timing objects. Three test cases then verify byte/nibble LUT bit-identity for all 256 byte values, bit-cell framing invariants, and wave8Transpose_4 output equivalence across real chipsets.

Changes

Wave8 real-chipset regression tests

Layer / File(s) Summary
Chipset timing helpers and byte/nibble LUT equivalence
tests/fl/channels/wave8.cpp
Defines makeRealTiming<T> and RealTimingEntry structs, then asserts that for every real chipset entry, both the nibble and byte wave8 LUTs produce bit-identical symbols for all 256 input byte values.
Framing invariant and transpose equivalence tests
tests/fl/channels/wave8.cpp
Adds a framing test checking the first symbol's MSB stays set and the last symbol's LSB stays clear for 0xFF/0x00, and a transpose test verifying wave8Transpose_4 output matches between nibble and byte LUTs across multiple 4-lane patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • FastLED/FastLED#2539: Introduced the byte-indexed wave8 LUT functionality that these new regression tests directly exercise for bit-identity against the nibble path.
  • FastLED/FastLED#2532: Rewrote the wave8 transpose logic and added the first wave8Transpose_4 equivalence tests in the same tests/fl/channels/wave8.cpp file that this PR extends.
  • FastLED/FastLED#2559: Introduced chipset-aware wave8Transpose_16_bf1 / wave8Transpose_16x4_bf1_pipe4 implementations that the new real-chipset framing and transpose regression tests target.

Poem

🐇 Hop, hop, through the chipset maze,
Eight bits dancing in a wave-like haze,
Nibble and byte side-by-side they run,
Framing stays true from first pulse to last one,
The rabbit checks them all — every lane done! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: adding regression tests for wave8 LUT across real chipset timings, with clear reference to issue #3023.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/wave8-cross-driver-test

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 and usage tips.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/fl/channels/wave8.cpp`:
- Around line 1362-1365: The FL_INFO debug statement at the specified location
outputs lane values with a "0x" prefix but prints them as decimal numbers
instead of hexadecimal. Fix this by applying proper hexadecimal formatting to
lanes[0], lanes[1], lanes[2], and lanes[3] in the output stream. Use the
appropriate hex formatting method available in your codebase (such as std::hex
manipulator or equivalent) to ensure the values are displayed as actual
hexadecimal numbers (e.g., "0xFF" instead of "0x255"), or alternatively remove
the "0x" prefix if printing decimal values is intentional.
- Around line 1285-1286: The FL_INFO logging statement outputs a "0x" prefix
followed by the variable b, but since b is an int, it will print in decimal
format (e.g., "byte=0x255" instead of the intended hexadecimal "byte=0xFF"),
which is misleading. Fix this by properly formatting b as hexadecimal before
logging. Check if the codebase provides a hex formatting utility (such as
fl::hex) and apply it to the b variable in the FL_INFO statement, or if no such
utility exists, remove the "0x" prefix from the message string to match the
actual decimal output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 53950a3e-acaa-4a12-979e-bf63ba1c2f08

📥 Commits

Reviewing files that changed from the base of the PR and between 6157361 and 91d3ce3.

📒 Files selected for processing (1)
  • tests/fl/channels/wave8.cpp

Comment on lines +1285 to +1286
FL_INFO("chipset=" << entry.name << " byte=0x" << b
<< " symbol=" << s);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Debug output prints decimal after "0x" prefix.

The FL_INFO statement outputs "byte=0x" << b, but b is an int that will print in decimal (e.g., "byte=0x255" instead of "byte=0xFF"). This misleading format could confuse debugging.

🔧 Suggested fix to use hex formatting

If the codebase provides a hex formatting utility (e.g., fl::hex), use it. Otherwise, consider changing the message to avoid the "0x" prefix or format the value properly before logging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fl/channels/wave8.cpp` around lines 1285 - 1286, The FL_INFO logging
statement outputs a "0x" prefix followed by the variable b, but since b is an
int, it will print in decimal format (e.g., "byte=0x255" instead of the intended
hexadecimal "byte=0xFF"), which is misleading. Fix this by properly formatting b
as hexadecimal before logging. Check if the codebase provides a hex formatting
utility (such as fl::hex) and apply it to the b variable in the FL_INFO
statement, or if no such utility exists, remove the "0x" prefix from the message
string to match the actual decimal output.

Comment on lines +1362 to +1365
<< " lanes={0x" << static_cast<int>(lanes[0])
<< ",0x" << static_cast<int>(lanes[1])
<< ",0x" << static_cast<int>(lanes[2])
<< ",0x" << static_cast<int>(lanes[3]) << "}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Debug output prints decimal after "0x" prefix (same issue as line 1285).

The FL_INFO statement outputs lane values as "0x" << static_cast<int>(lanes[i]), which prints decimal values (e.g., "0x255") instead of hex ("0xFF").

🔧 Suggested fix

Use hex formatting if available in the codebase, or remove the "0x" prefix to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fl/channels/wave8.cpp` around lines 1362 - 1365, The FL_INFO debug
statement at the specified location outputs lane values with a "0x" prefix but
prints them as decimal numbers instead of hexadecimal. Fix this by applying
proper hexadecimal formatting to lanes[0], lanes[1], lanes[2], and lanes[3] in
the output stream. Use the appropriate hex formatting method available in your
codebase (such as std::hex manipulator or equivalent) to ensure the values are
displayed as actual hexadecimal numbers (e.g., "0xFF" instead of "0x255"), or
alternatively remove the "0x" prefix if printing decimal values is intentional.

@zackees
zackees merged commit b34d8ca into master Jun 14, 2026
5 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 14, 2026
@zackees
zackees deleted the feat/wave8-cross-driver-test branch August 21, 2026 19:15
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