You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(channels): drop incomplete runtime WS2812 frames - #5475
Runtime WS2812 channels can leave a prefix in the encoded buffer when a bulk writer cannot grow it. Check the emitted byte count against the input pixel count and the active RGB, RGBW, or RGBWW format before notifying listeners or submitting. Drop the incomplete buffer so a later show can retry without consuming a dither phase.
The host regression injects a buffer-local allocation limit on a 33-pixel channel, then lifts it and confirms that all 99 bytes are submitted. Before the fix, the failed frame reached the capturing driver. After the fix, the sanitizer run and lint on all three changed files passed. Full C++ validation is running.
Summary by CodeRabbit
Bug Fixes
WS2812 frames are submitted only when encoding completes successfully, preventing incomplete frames from being sent or reported as encoded. Successful frames continue to be processed normally.
CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.
Parsing warnings: 1
Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
No actionable comments were generated in the recent review.
Walkthrough
The channel now validates WS2812 frame encoding before it fires the encoded-data event or submits a frame. A regression test covers allocation failure and successful encoding.
Changes: WS2812 Frame Validation
Layer / File(s)
Summary
Validate and submit frames src/fl/channels/channel.h, src/fl/channels/channel.cpp.hpp, tests/unit/fl/channels/channel.cpp
encodeFrame returns a success flag and checks that WS2812 output matches the expected size. showPixels submits only successful frames. The test checks that allocation failure produces no captured frame or encoded event and does not advance the dither phase; it also checks successful encoding.
FastLED/FastLED#5474: Applies the same incomplete-frame handling to the legacy SPI frame path.
Merge Risk: Minimal · up to ae7ac
This change stops incomplete WS2812 frames from being sent or announced when a buffer allocation fails, so a later show can retry cleanly. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(channels): drop incomplete runtime WS2812 frames" matches the main change. The changeset makes showPixels submit a frame only when encodeFrame succeeds, and encodeFrame now returns bool…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(channels): drop incomplete runtime WS2812 frames" matches the main change. The changeset makes showPixels submit a frame only when encodeFrame succeeds, and encodeFrame now returns bool and rejects a WS2812 buffer whose size does not equal pixel count times bytes per pixel. The title names the channel area, the WS2812 encoder, and the dropped incomplete frame behavior. The title is specific and concise, and it does not depend on file names or vague terms.
Finishing Touches
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.
Reviewing files that changed from the base of the PR and between c9cfcae and ae7acb2.
Files selected for processing: 3
src/fl/channels/channel.cpp.hpp
src/fl/channels/channel.h
tests/unit/fl/channels/channel.cpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
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, Same is unchanged).
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
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.
Follow-up to #5356.
Runtime WS2812 channels can leave a prefix in the encoded buffer when a bulk writer cannot grow it. Check the emitted byte count against the input pixel count and the active RGB, RGBW, or RGBWW format before notifying listeners or submitting. Drop the incomplete buffer so a later show can retry without consuming a dither phase.
The host regression injects a buffer-local allocation limit on a 33-pixel channel, then lifts it and confirms that all 99 bytes are submitted. Before the fix, the failed frame reached the capturing driver. After the fix, the sanitizer run and lint on all three changed files passed. Full C++ validation is running.
Summary by CodeRabbit