Skip to content

fix(channels): reject incomplete clockless chipset frames - #5478

Merged
zackees merged 1 commit into
masterfrom
fix/runtime-clockless-incomplete-frame
Dec 3, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/runtime-clockless-incomplete-frame

Conversation

@zackees

@zackees zackees commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #5356. This stacks on #5477 because it uses the encoder status introduced there.

TM1812, TM1908 and UCS7604 could submit a truncated clockless frame when the output vector failed to grow. Their encoders now verify the protocol frame length. The channel drops incomplete frames before it notifies listeners, submits to the driver or advances dither. A later show can retry after allocation recovers.

The runtime regression covers WS2812, TM1812, TM1908 and UCS7604. The original code failed with a partial TM1812 submission under sanitizers. The completed change passed the focused sanitizer run and changed-file lint. Full host validation is running.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability for UCS7604, TM1812, and TM1908 lighting output. Frames with invalid or incomplete sizes are now reported as failed rather than successful.
    • When memory allocation temporarily prevents a frame from being completed, the incomplete frame is not captured and the dither phase does not advance. After allocation is available again, the encoder can produce a frame of the expected size.

@zackees zackees added the ci-full Run the complete release-equivalent CI matrix on this PR SHA label Nov 25, 2026
@fastled-project-sync fastled-project-sync Bot moved this to In Progress in FastLED Tracker Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

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"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

Clockless encoders now check that encoded output matches expected frame sizes and report failures when checks fail. Tests cover allocation failure and retry behavior for WS2812, TM1812, TM1908, and UCS7604.

Changes: Clockless frame completeness

Layer / File(s) Summary
Encoder frame-size validation
src/fl/channels/channel.cpp.hpp
UCS7604 checks for overflow and verifies its encoded size. TM1812 RGBWW and TM1908 verify their expected frame sizes. UCS7604 propagates the encoding result.
Allocation-failure and retry coverage
tests/unit/fl/channels/channel.cpp
A table-driven test covers four clockless encoders. It checks that allocation failure produces no captured frame or encoded event and does not advance the dither phase, then checks that a retry captures the expected frame and emits one encoded event.

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

Change: Bug fix

Possibly related issues

  • Issue 5492, item 1, tracks the clockless incomplete-frame behavior after allocation failure. This change addresses that item.

Possibly related PRs

  • FastLED/FastLED#5475: Both changes address incomplete clockless frames; this PR adds size checks for TM1812, TM1908, and UCS7604 and tests WS2812 as well.
  • FastLED/FastLED#5477: This PR uses the encoder status introduced by the base PR to report clockless encoding failures.
Merge Risk: Minimal · up to 36bc6

The change stops incomplete clockless frames from being submitted when an allocation fails, and a later show can retry. Tests cover four chipsets. No merge-blocking risk is visible.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: clockless chipset encoders (TM1812, TM1908, UCS7604) now reject incomplete frames. The changeset matches this. The summary confirms that writeUCS7604 and the TM1812/TM…
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.
Full details: Title check

Explanation

The title names the main change: clockless chipset encoders (TM1812, TM1908, UCS7604) now reject incomplete frames. The changeset matches this. The summary confirms that writeUCS7604 and the TM1812/TM1908 encoders verify frame size and return failure on mismatch, and that the channel propagates the failure. The title uses the fix(channels) convention and is short, specific, and clear.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • 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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bc3caab and 36bc6d5.

Files selected for processing: 2

  • src/fl/channels/channel.cpp.hpp
  • 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; 7 remain after this review.

@zackees
zackees force-pushed the fix/runtime-spi-incomplete-frame branch from 4c3f93c to bcf59a1 Compare December 2, 2026 07:48
Base automatically changed from fix/runtime-spi-incomplete-frame to master December 2, 2026 08:30
@zackees
zackees force-pushed the fix/runtime-clockless-incomplete-frame branch from 6722546 to 36bc6d5 Compare December 3, 2026 02:30
@zackees
zackees marked this pull request as ready for review December 3, 2026 02:30
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Memory usage (this PR vs. its merge base)

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).

Target FLASH [bytes] RAM [bytes]
attiny85 2,460 (Same) 136 (Same)
esp32c3 322,844 (Same) 13,814 (Same)
esp32c6 351,430 (Same) 17,905 (Same)
esp32s3 318,723 ($\color{red}\uparrow$ 4) 22,519 (Same)
esp8266 264,607 (Same) 6,808 (Same)
nrf52840_dk 66,976 (Same) 19,468 (Same)
rp2040 102,004 (Same) 8,624 (Same)
stm32f103c8 21,676 (Same) 1,789 (Same)
teensy41 46,080 (Same) 21,738 (Same)
uno 3,644 (Same) 134 (Same)

No comparison (build missing on one side): esp32dev

@zackees
zackees added this pull request to the merge queue Dec 3, 2026
Merged via the queue into master with commit dc8f2cb Dec 3, 2026
247 of 248 checks passed
@zackees
zackees deleted the fix/runtime-clockless-incomplete-frame branch December 3, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run the complete release-equivalent CI matrix on this PR SHA

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant