Repository navigation
Closed
Labels
Description
Motivation
FastLED.setExclusiveDriver(const char* name) (and the equivalent ChannelManager::setExclusiveDriver(const char*)) is the only string-based knob left on the public driver-selection surface after #2459 / #2460 introduced the typed `fl::Bus` enum. For built-in drivers this is strictly worse than the typed form — `fl::Bus::RTM` is a compile error, `"RTM"` is a silent runtime fall-through.
The string form does have legitimate callers, though, so it can't be removed outright:
- AutoResearch (4 sites) — driver name comes from RPC/JSON at runtime, can resolve to any registered driver.
- Mock-test infrastructure (13 sites in `tests/fl/channels/spi_channel.cpp`) — registers custom mock drivers like `MockSpiEngine("MOCK_SPI")` whose names are not in `fl::Bus`.
Both already go through `ChannelManager` directly (`manager.setExclusiveDriver(...)`), not the `FastLED.` facade.
Proposal
Public facade (`FastLED.setExclusiveDriver`):
- Replace `(const char*)` with `(fl::Bus)`. Typed, typo-safe. This is what 99% of user code should use.
Lower-level (`ChannelManager`):
- Rename `ChannelManager::setExclusiveDriver(const char*)` → `ChannelManager::setExclusiveDriverByName(const char*)`. Same behavior, name signals "this is the by-name escape hatch — you probably want the typed form."
- Add `ChannelManager::setExclusiveDriver(fl::Bus)` overload that calls `setExclusiveDriverByName(busName(b))`.
AutoResearch helper (new):
- New helper in `examples/AutoResearch/` that calls `FastLED.enableAllDrivers()` then `ChannelManager::instance().setExclusiveDriverByName(name)`. AutoResearch's 4 call sites switch to this.
Mock tests:
- 13 call sites switch from `manager.setExclusiveDriver("MOCK_X")` to `manager.setExclusiveDriverByName("MOCK_X")`.
Net effect
- `FastLED.setExclusiveDriver()` is typed-only (the public API users see).
- The string form survives where it's actually needed (mocks + runtime-resolved names), but no longer presents itself as the obvious default — it's relegated to `setExclusiveDriverByName` on `ChannelManager`.
- Existing string usage migrates mechanically with a rename.
Acceptance criteria
- `bash test --cpp` passes
- `bash lint` clean
- `FastLED.setExclusiveDriver("RMT")` no longer compiles
- `FastLED.setExclusiveDriver(fl::Bus::RMT)` works
- `ChannelManager::setExclusiveDriverByName("MOCK_X")` works for mock-driver registration
- AutoResearch RPC paths continue to function (via the new helper)
- README + release_notes updated to show `fl::Bus` form first
Activity
refactor(channels): typed FastLED.setExclusiveDriver(fl::Bus) + lower…