Repository navigation
test(channels): widen wave8 LUT regression matrix to real chipset timings (refs #3023) - #3028
Conversation
…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]>
📝 WalkthroughWalkthroughAdds 145 lines of regression tests to ChangesWave8 real-chipset regression tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
tests/fl/channels/wave8.cpp
| FL_INFO("chipset=" << entry.name << " byte=0x" << b | ||
| << " symbol=" << s); |
There was a problem hiding this comment.
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.
| << " 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]) << "}"); |
There was a problem hiding this comment.
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.
Summary
Adds three host test cases to
tests/fl/channels/wave8.cppthat walk arepresentative set of real chipset timings (WS2812, WS2812B-V5, WS2813,
SK6812, UCS1903B, TM1809, PL9823, WS2811, WS2815, UCS1903_400KHZ):
Path equivalence:
buildWave8ByteExpansionLUTis bit-identicalto 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.)
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.
Transposition equivalence:
wave8Transpose_4produces identicaloutput whether driven from the nibble LUT or the byte LUT.
Catches LUT-rebuild regressions in
src/fl/channels/wave8.cpp.hppthatonly 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_wave8passes (1/1) — verified locally with allthree new test cases compiling and running green.
src/fl/channels/wave8.h).mocks involved.
Refs #3023
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes