Skip to content

perf(channels): check driver enabled state by instance in show paths (#4799) - #4820

Merged
zackees merged 1 commit into
masterfrom
perf/4799-driver-enabled-by-pointer
Oct 9, 2026
Merged

zackees merged 1 commit into
masterfrom
perf/4799-driver-enabled-by-pointer

Conversation

@zackees

@zackees zackees commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Part of #4801. Addresses #4799 (the per-frame string work in the show path).

Change

SlimBridgeController, SlimSpiBridgeController and the Teensy 4 block clockless controller called isDriverEnabled(driver.getName().c_str()) on every frame. That built an fl::string per frame and compared names against every registry entry.

The new ChannelManager::isDriverEnabled(const IChannelDriver&) matches the registry entry by pointer. It falls back to the name for an instance that isn't the registered one, which preserves the old semantics. Those three paths now use it.

Not changed, and why

  • resolveDriver() bus key: a non-allocating literal string.
  • Per-frame driver selection: it has to stay per frame because it depends on live driver capacity (for example the I2S 16-lane overflow).
  • ID-based driver names: turning IChannelDriver::getName() into IDs means 32 overrides, about 140 call sites and a public interface change; deferred.

Evidence (dashboard protocol)

flash before → after
esp32dev Blink 291,788 → 291,760 (−28)
esp32dev APA102 275,944 → 276,012 (+68, name fallback)
esp32s3 Blink / APA102 393,892 → 393,860 / 394,012 → 394,016
  • New unit test in tests/fl/channels/manager.cpp: pointer match, disable, and name fallback.
  • bash test --cpp passes. bash lint passes. teensy40/41 budgets pass.

Summary by CodeRabbit

  • Bug Fixes
    • Driver enablement checks now recognize registered driver instances directly, including when multiple instances share a name. Unregistered drivers continue to use the registered driver name as a fallback. Disabled drivers still have their frames dropped.

…4799)

SlimBridgeController, SlimSpiBridgeController and the Teensy 4 block
clockless controller called isDriverEnabled(driver.getName().c_str()) every
frame: an fl::string per frame plus a name compare per registry entry. Add
ChannelManager::isDriverEnabled(const IChannelDriver&), which matches the
registry entry by pointer (falling back to the name for an unregistered
instance), and use it on those paths.

Flash ~neutral (esp32dev Blink -28 B, APA102 +68 B); per-frame string work
removed. Unit test covers pointer match, disable, and the name fallback.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2e7f78d1-2ba6-4695-9852-428a499f3234

📥 Commits

Reviewing files that changed from the base of the PR and between 66846f1 and 3fa2dfe.


📒 Files selected for processing (6)
  • src/fl/channels/manager.cpp.hpp
  • src/fl/channels/manager.h
  • src/fl/channels/slim_bridge_controller.h
  • src/fl/channels/slim_spi_bridge_controller.h
  • src/platforms/arm/teensy/teensy4_common/block_clockless_arm_mxrt1062.h
  • tests/fl/channels/manager.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.



📝 Walkthrough

Walkthrough

ChannelManager adds an overload that checks driver enablement by instance, with name-based fallback for unregistered instances. Three show paths now pass driver instances to this overload, and tests cover instance lookup and fallback behavior.

Changes

Driver Enablement Lookup

Layer / File(s) Summary
Instance-based lookup
src/fl/channels/manager.h, src/fl/channels/manager.cpp.hpp
ChannelManager adds an overload that checks a registered driver instance’s enabled state. If the instance is not registered, the method checks enablement by name.
Show-path integration and coverage
src/fl/channels/slim_bridge_controller.h, src/fl/channels/slim_spi_bridge_controller.h, src/platforms/arm/teensy/teensy4_common/block_clockless_arm_mxrt1062.h, tests/fl/channels/manager.cpp
Three show paths pass the driver instance to the new overload. Tests cover instance-based lookup and name-based fallback.

Priority: ⬇️ Low

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

Change: Refactor


Merge Risk: ⚪ Minimal · up to 3fa2d

The show paths retain their enabled-driver behavior while using instance-based lookup; no material merge risk remains.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: checking driver enabled state by instance in channel show paths.
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.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 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.

❤️ Share

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant