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
feat(channels): add named worker priorities with no memory growth - #5018
Adds fl::Priority::{Auto, High, Medium, Low} to FastLED.addLeds() after the existing core argument and to ChannelOptions::mWorker.priority. LCD/I2S Auto starts at High (23 on ESP32); Medium maps to 12 and Low to 1. Existing shared-worker inheritance, conflict rejection, and unsupported-driver rejection remain intact.
Default policies compile to a no-op, without driver singleton access or per-controller fields. WorkerConfig shrinks from 3 to 2 bytes. The scheduler mapping remains confined to the supported LCD backend. A redundant diagnostic-only argument was removed from the RMT allocation fallback helper to offset the small Xtensa linker-relaxation change; allocation behavior and diagnostics are preserved.
Matched default Blink measurements against f9beb26cee26d48a6d7213c1c1464f157a133754, with the same fbuild 2.5.51/toolchains:
Target
Allocated image before → after
Static RAM before → after
ESP32-S3
320259 → 320259 B
73384 → 73384 B
ESP32dev
287555 → 287555 B
23520 → 23520 B
Uno
3600 → 3600 B
118 → 118 B
Validation: 330/330 native unit groups and 95/95 examples passed under sanitizers; targeted LCD, slim-controller and RMT allocator groups passed; full lint passed. S3 AutoResearch compiled against the actual SDK with named High exercised through both APIs. Layout/default-path tests guard against configuration growth and lazy singleton allocation. Repository/pre-push review found no actionable issues.
The attached boards are ESP32dev and two C6s, so live S3 worker/wire validation is not claimed. Runtime numeric priority assignments must migrate to the enum (23 → fl::Priority::High). The existing addLeds/core template positions remain compatible.
Refs #5001. Details and reproducible measurements: agents/tasks/issue-5001-priority.md.
Summary by CodeRabbit
New Features
Added named Auto, High, Medium, and Low worker priorities to supported LED configuration options, including compile-time and runtime setup. Existing configurations retain automatic priority behavior.
Documented platform mappings and constraints for worker priorities.
Bug Fixes
Unsupported priority settings and conflicting changes to shared workers are rejected.
Explicit worker-core configurations now use high priority in the affected examples.
No actionable comments were generated in the recent review.
Walkthrough
The PR adds named worker-priority policies to channel configuration and threads them through clockless and SPI controller APIs. ESP32 LCD workers resolve the policies to task priorities. Tests and documentation cover the new behavior. A separate RMT change derives a diagnostic word count inside the allocation failure helper.
Changes: Named worker priority
Layer / File(s)
Summary
Priority policy and worker configuration src/fl/channels/worker_config.h, src/fl/channels/worker_policy.h
WorkerConfig now uses Priority values Auto, High, Medium, and Low. Worker-policy templates accept priority-only settings and pass both core and priority to supported controllers.
Priority forwarding through addLeds src/FastLED.h, src/fl/channels/slim_bridge_controller.h, src/fl/channels/slim_spi_bridge_controller.h, src/chipsets.h, src/fl/chipsets/*, examples/AutoResearch/*
Clockless and SPI addLeds overloads and worker-aware controller aliases now forward priority. The explicit-core example calls set High.
The LCD worker maps Auto and High to the default priority, Medium to half the available priority count, and Low to 1. It uses the resolved value for worker configuration and task creation.
Priority validation and documentation tests/fl/channels/*, tests/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp, src/fl/channels/README.md, agents/tasks/*
Tests cover priority forwarding, controller size, worker acceptance, and ESP32 mappings. Documentation and task notes describe policy defaults, supported settings, measurements, and validation results.
RMT allocation diagnostic
Layer / File(s)
Summary
Derive diagnostic word count src/platforms/esp/32/drivers/rmt/rmt_5/rmt_memory_manager.cpp.hpp, src/platforms/esp/32/drivers/rmt/rmt_5/rmt_memory_manager.h
handleAllocateTxFailure no longer accepts words_needed. It derives the value from mem_blocks when runtime logging is enabled.
sequenceDiagram
participant CFastLED
participant ClocklessWorkerController
participant WorkerPolicy
participant LCDClocklessDriver
CFastLED->>ClocklessWorkerController: forward core and priority
ClocklessWorkerController->>WorkerPolicy: apply worker policy
WorkerPolicy->>LCDClocklessDriver: configure worker
LCDClocklessDriver->>LCDClocklessDriver: resolve named priority for task
Loading
Possibly related issues
Issue 5001: This PR adds LCD worker priority selection, but does not add the core selection described in the issue.
Issue 2974: The PR changes the diagnostic argument handling in handleAllocateTxFailure, a function identified by the issue’s related sub-item. It does not move the formatting and logging machinery into a cold helper.
Possibly related PRs
FastLED/FastLED#5003: This PR changes the worker configuration interface and templates introduced by that PR.
No actionable merge-blocking issue is established. The change appears mergeable subject to normal build and test checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 24.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: adding named worker priorities while preserving memory usage.
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: Docstring Coverage
Explanation
Docstring coverage is 24.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 25 functions across 18 files. (4 skipped: 4 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 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, 0 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.
Adds
fl::Priority::{Auto, High, Medium, Low}toFastLED.addLeds()after the existing core argument and toChannelOptions::mWorker.priority. LCD/I2S Auto starts at High (23 on ESP32); Medium maps to 12 and Low to 1. Existing shared-worker inheritance, conflict rejection, and unsupported-driver rejection remain intact.Default policies compile to a no-op, without driver singleton access or per-controller fields. WorkerConfig shrinks from 3 to 2 bytes. The scheduler mapping remains confined to the supported LCD backend. A redundant diagnostic-only argument was removed from the RMT allocation fallback helper to offset the small Xtensa linker-relaxation change; allocation behavior and diagnostics are preserved.
Matched default Blink measurements against
f9beb26cee26d48a6d7213c1c1464f157a133754, with the same fbuild 2.5.51/toolchains:Validation: 330/330 native unit groups and 95/95 examples passed under sanitizers; targeted LCD, slim-controller and RMT allocator groups passed; full lint passed. S3 AutoResearch compiled against the actual SDK with named High exercised through both APIs. Layout/default-path tests guard against configuration growth and lazy singleton allocation. Repository/pre-push review found no actionable issues.
The attached boards are ESP32dev and two C6s, so live S3 worker/wire validation is not claimed. Runtime numeric priority assignments must migrate to the enum (
23→fl::Priority::High). The existing addLeds/core template positions remain compatible.Refs #5001. Details and reproducible measurements:
agents/tasks/issue-5001-priority.md.Summary by CodeRabbit
Auto,High,Medium, andLowworker priorities to supported LED configuration options, including compile-time and runtime setup. Existing configurations retain automatic priority behavior.