Skip to content

fix(channels): opt-in driver registration no longer links every platform driver (#4618) - #4630

Merged
zackees merged 1 commit into
masterfrom
fix/4618-lazy-channel-driver-init
Sep 25, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4618-lazy-channel-driver-init

Conversation

@zackees

@zackees zackees commented Sep 25, 2026

Copy link
Copy Markdown
Member

Closes #4618. Part of #4601 / #4580.

What changed

  • New ChannelManager::registry() returns the singleton without running platforms::initChannelDrivers().
  • Every BusTraits<B>::registerWithManager() (Teensy, RP, LPC, ESP32, bit-bang) and the legacy addLeds<> slim bridges (SlimBridgeController, SlimSpiBridgeController) now use registry(). A sketch that names one bus links only that engine.
  • ChannelManager::instance() is unchanged. It still registers the platform defaults on first use. FastLED.add(cfg) (which also calls enableAllDrivers()), Channel dispatch, and the driver-query and exclusive-driver APIs all go through it, so the Channel API keeps its runtime-selection behaviour.
  • Audit: Teensy 4.x and RP initChannelDrivers() were the heavy ones (SPI adapter, FlexIO, UART, PIO). SAMD21/51, STM32 and nRF52 register only the SPI adapter, and only from instance(), so they now also stay out of slim-bridge-only builds. ESP32 was already empty.

Bloat (Blink, bash bloat <board> --example Blink --build)

board build flash before after delta
teensy41 101,376 B 82,944 B -18,432 B (attributed 84,702 -> 69,322)
rp2040 351,800 B 332,380 B -19,420 B (firmware.bin 136,996 -> 117,396)

ObjectFLED and the RP PIO engine are still linked. Only the unused defaults were dropped.

Verification

  • bash compile teensy41|rp2040 --examples Blink,BlinkParallel,Apa102,RGBWW (RGBWW uses FASTLED.add( Channel API), bash compile esp32s3 --examples Apa102: all pass
  • bash test --cpp: 314/314 unit and 95/95 examples pass
  • bash lint: clean

Code review (/code-review medium)

  • MEDIUM: Teensy initChannelDrivers() re-added FlexIO#1 at priority 8 after an opt-in registration at priority 3. That replaced the entry and blocked in waitForReady(), so the final priority depended on call order. Fixed: init now skips FlexIO#1 when it is already registered.

Hardware

Hardware validation is deferred (maintainer decision), tracked in #4623.

🤖 Generated with Claude Code

…ation (#4618)

Add ChannelManager::registry(), which returns the singleton without running
platforms::initChannelDrivers(). BusTraits<B>::registerWithManager() and the
legacy addLeds<> slim bridges now use it, so a sketch that names one bus links
only that engine. ChannelManager::instance() (FastLED.add(cfg), driver
queries, Channel dispatch) still registers the platform defaults on first use,
so the Channel API keeps working unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees merged commit 1c237f5 into master Sep 25, 2026
61 of 62 checks passed
@zackees
zackees deleted the fix/4618-lazy-channel-driver-init branch September 25, 2026 05:32
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 25, 2026
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 07d9cc63-0899-4c12-b145-45492118f6da

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf4e36 and 68ea331.

📒 Files selected for processing (22)
  • 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/lpc/drivers/sct_dma/bus_traits.h
  • src/platforms/arm/lpc/drivers/uart_dma/bus_traits.h
  • src/platforms/arm/rp/rpcommon/rp_pio_tx_bus_traits.h
  • src/platforms/arm/rp/rpcommon/rp_spi_bus_traits.h
  • src/platforms/arm/rp/rpcommon/rp_uart_bus_traits.h
  • src/platforms/arm/teensy/teensy4_common/drivers/flexio/bus_traits.h
  • src/platforms/arm/teensy/teensy4_common/drivers/lpuart/bus_traits.h
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/bus_traits.h
  • src/platforms/arm/teensy/teensy4_common/init_channel_driver_mxrt1062.cpp.hpp
  • src/platforms/esp/32/drivers/i2s_spi/bus_traits.h
  • src/platforms/esp/32/drivers/lcd_cam/bus_traits.h
  • src/platforms/esp/32/drivers/lcd_spi/bus_traits.h
  • src/platforms/esp/32/drivers/parlio/bus_traits.h
  • src/platforms/esp/32/drivers/rmt/rmt_4/bus_traits.h
  • src/platforms/esp/32/drivers/rmt/rmt_5/bus_traits.h
  • src/platforms/esp/32/drivers/spi/bus_traits.h
  • src/platforms/esp/32/drivers/uart/bus_traits.h
  • src/platforms/shared/bitbang/bus_traits.h
 ____________________________________________________________________________________
< Half-Life 3 could have been released by now, but I'm too busy reviewing your code. >
 ------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

zackees added a commit that referenced this pull request Sep 25, 2026
…, bloat re-pin)

- tests: qualify unqualified printf as fl::printf in vocal.hpp, ui.cpp and
  executor.cpp; single-arg calls were ambiguous with the SDK printf on
  macOS and Windows (only built under ci-full).
- ci/tests: test_esp32_rmt4_reset_timing follows the WAIT_TIME/reset_us
  rule into SlimBridgeController after #4604.
- bloat: claim -17,270 B already on master (#4630, #4603-#4605).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

ChannelManager eagerly initialises every platform channel driver once linked (+~11 KB on Teensy 4.x)

1 participant