Repository navigation
fix(spi): legacy addLeds SK9822/APA102 controllers use all-ones end clocks - #3684
Merged
Merged
Conversation
…locks Commit 34a86a7 (#3669) fixed the channel-engine encoders (fl/chipsets/encoders/{apa102,sk9822}.h) to emit all-ones (0xFFFFFFFF per DWord) end-clock frames, matching the vendor datasheet requirement that end clocks be all-ones so the final LED frame fully shifts through a long cascade. The legacy addLeds<> controller templates in fl/chipsets/apa102.h were never updated and still emitted mostly-zero end clocks (APA102Controller: 0xFF000000; APA102ControllerHD, SK9822Controller, SK9822ControllerHD, HD107Controller: 0x00000000), which on long cascades can be misread as a new start frame. Align all APA102-family legacy controller defaults with the encoder contract, drop the now-stale "different END_FRAME" doc comments on SK9822Controller/SK9822ControllerHD, and add public getStartFrame()/ getEndFrame() accessors so the wire-protocol contract is unit testable without hardware. Closes #3682
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAPA102-family legacy controllers now use all-ones end frames. Public constexpr accessors expose start and end frame values, and SPI protocol tests verify these values across APA102, SK9822, and HD107 variants. ChangesAPA102 end-frame alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3682
Summary
Commit 34a86a7 (#3669) fixed the channel-engine encoders (
fl/chipsets/encoders/{apa102,sk9822}.h) to emit all-ones (0xFFFFFFFFper DWord) end-clock frames, matching the vendor datasheet requirement — these clocks shift the final LED frame through a long cascade, and a zero/partial end frame is not a substitute because it can be misread as a new start frame.The legacy
addLeds<>controller templates insrc/fl/chipsets/apa102.hwere never updated and still emitted mostly-zero end clocks:APA102Controllerbase default:END_FRAME = 0xFF000000APA102ControllerHD,SK9822Controller,SK9822ControllerHD,HD107Controller:END_FRAME = 0x00000000On a long cascade (>32 LEDs) driven through the classic
FastLED.addLeds<SK9822, ...>path, this meant the final LED frame wasn't fully shifted through, and the wrong end frame could be misread as a new start frame — the same failure #3669 already fixed on the newer channel-engine path.Changes
src/fl/chipsets/apa102.h: align all fiveEND_FRAMEdefaults with the encoder contract (0xFFFFFFFF).HD107HDControllerinherits the fix transitively throughAPA102ControllerHD(no explicit override needed).SK9822Controller/SK9822ControllerHD— after this fix,END_FRAMEis identical between APA102 and SK9822; only the defaultSPI_SPEEDdiffers.getStartFrame()/getEndFrame()public static accessors toAPA102Controllerso the wire-protocol contract is directly unit-testable without needing hardware or SPI byte capture.tests/fl/chipsets/spi_frame_protocol.cpp: new test case assertinggetEndFrame() == 0xFFFFFFFF/getStartFrame() == 0x00000000for every affected legacy controller template.This is a maintainer-authorized wire-protocol default change per the issue's own note ("changing shipped wire output needed your sign-off rather than a drive-by fix") — filed and directed by the repo admin.
Testing
bash test spi_frame_protocol --cpp— RED before the header fix (6 assertions failing with the old END_FRAME values), GREEN after.bash test spi_frame_protocol --debug— sanitizer pass, clean.bash test fastled_core --cpp— sanity check for existingAPA102addLeds usage, still passing.bash lint --cpp <changed files>— clean (both changed files pass all C++ lint checks).Summary by CodeRabbit
Bug Fixes
New Features
Tests