Skip to content

feat(esp32): preserve async output on the slim legacy RMT4 path - #4885

Merged
zackees merged 3 commits into
perf/esp32-legacy-slim-rmt4from
feat/esp32-rmt4-async-legacy
Oct 22, 2026
Merged

zackees merged 3 commits into
perf/esp32-legacy-slim-rmt4from
feat/esp32-rmt4-async-legacy

Conversation

@zackees

@zackees zackees commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

Implements #4883 on top of #4881. Async is enabled by default, following the maintainer's updated requirement. FL_RMT4_ASYNC=0 selects blocking output.

  • Reuse the existing RMT4 engine/translator behind a lazy 2 KB FreeRTOS worker. Pending strips advance, reset holds complete, and leases release without further application calls.
  • Retain active and pending encoded snapshots through caller edits, controller removal and reconfiguration. Preserve standalone legacy output, controller enable/disable, mixed Channel APIs and other direct backend policies.
  • Route FastLED.wait() through registered completion callbacks without pulling ChannelManager into legacy-only sketches.
  • Reserve exact encoded capacity before writing; reject allocation failure instead of transmitting partial frames. Make queue transfer and shared TX/RX ledger allocation failures explicit.
  • Correct refill deadlines to use a shared ISR-safe clock and rebase after SDK preload. Preserve deadline checks and report aborted output as failure.
  • Include the independently reproduced string-growth OOM/RPC framing prerequisite: real schema discovery exposed an existing heap overwrite during device validation.

Matched footprint

96 RGB LEDs, Lolin D32, fbuild, espressif32 6.13.0 / Arduino 2.0.17 / IDF 4.4.7, diagnostics disabled:

Consumer Flash Physical static RAM
Slim legacy blocking 290,306 B 23,708 B
Slim legacy default async 293,006 B 23,716 B
Channel API default async 363,022 B 25,236 B

Async costs 2,700 B flash / 8 B static RAM versus matched blocking. Both legacy bloat reports contain zero executable ChannelManager functions. Channel API also registers other available backends, so its entire delta is not solely ChannelManager. Runtime heap/worker storage are separate costs. Exact encoding saves 10,460 B retained capacity for five 2,000-RGB-LED strips (30,000 instead of 40,460 B).

Matched device harness: blocking free heap 110,208 -> 109,424 B; async
109,584 -> 106,384 B after a completed 2,000-LED frame. Async retains 3,040 B
additional heap
, including its 2,048 B stack (624 B exists before submission).
Largest free block remains 65,524 B. Minimum free: blocking 57,540 / async
54,556 B. These are diagnostic harness measurements, separate from the small
reporter above. Blocking takes 66,887 us and returns after all 6,000 bytes;
async takes 7,062 us, returns active and completes all 6,000 bytes autonomously.

Validation

  • Focused RED -> GREEN: queue insertion OOM (selective revert restored afterward), completion dispatch, encoding reservation, refill deadline rebasing and string-growth ASAN overflow.
  • Native debug/sanitizer validation: initial full run passes 325 units and 95 examples; final bash test --cpp --debug rerun passes all 294 units and 57 examples selected by the runner. Full bash lint passes.
  • Classic ESP32 connected device: 11 scenarios pass with a 2 KB stack, including normal/legacy-only output, five strips sharing three TX slots, standalone show, enable/disable, backpressure, same-pin replacement and mixed APIs.
  • Overflow translates all 30,000 bytes with all encoded snapshots checked, five reset holds, zero latch violations, all pads active and autonomous lease release after controller/source destruction.
  • Real task/mutex allocation and SDK install failure injection consumes each fault once, releases resources and recovers. Unavailable hardware/setup failures release leases autonomously.
  • Real 1 ms timeout aborts after 120 of 12,000 bytes; the same driver sends a subsequent frame successfully. Stack unused: at least 1,196 B normal scenarios; 1,236 B timeout.
  • Short same-pin RX loopback validates bytes. Long tests validate translator byte counts, pin activity and forward progress; they do not establish full waveform correctness or Wi-Fi/flash stress parity.
  • Invalid first submission followed by a valid strip preserves the batch error, transmits the valid 3 bytes, releases leases and recovers on the same driver (1,136 stack bytes unused).
  • Independent code review: no remaining blockers. No new GitHub Actions workflow.

Integration

Stacked on perf/esp32-legacy-slim-rmt4 (#4881), itself stacked on #4877. Requires ci-full before a platform-sensitive merge. No merge performed by this PR publication.

Fixes #4883

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

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f125143-9919-4d6a-a820-b64be5125d4f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

Comment @coderabbitai help to get the list of available commands.

…#4887)

* fix(esp32): use native consoles without Arduino stream dependencies

* docs: record native ESP console validation and publication
@zackees
zackees merged commit fa5745d into perf/esp32-legacy-slim-rmt4 Oct 22, 2026
2 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 22, 2026
@zackees
zackees deleted the feat/esp32-rmt4-async-legacy branch November 5, 2026 22:52
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: Done

Development

Successfully merging this pull request may close these issues.

1 participant