FastLED 3.10.8
Loading...
Searching...
No Matches

◆ clearAllDrivers()

void fl::ChannelManager::clearAllDrivers ( )

Remove all drivers from the manager.

Note
Clears the entire driver registry
Useful for FastLED.reset() with CHANNEL_DRIVERS flag
Waits for all drivers to become READY before clearing (1 second timeout)
Also clears any exclusive-driver filter set by setExclusiveDriver*(). The filter names a driver in the registry being emptied, and addDriver() consults it, so keeping it would silently disable every subsequently added driver.

Definition at line 227 of file manager.cpp.hpp.

227 {
228 FL_DBG("ChannelManager: Waiting for all drivers to become READY before clearing");
229
230 // Wait for all drivers to become READY before clearing
231 // This prevents clearing drivers that are still transmitting
232 waitForReady();
233
234 FL_DBG("ChannelManager: Clearing " << mDrivers.size() << " drivers");
235
236 for (auto& entry : mDrivers) {
237 if (entry.driver) {
238 entry.driver->setPollNeededCallback(IChannelDriver::PollNeededCallback());
239 }
240 }
241
242 // Clear all drivers (shared_ptr handles cleanup automatically)
243 mDrivers.clear();
244
245 // Drop the exclusive-driver filter along with the registry it refers to.
246 // Leaving it set would name a driver that no longer exists, and
247 // addDriver() consults it -- so every driver registered afterwards would
248 // arrive silently disabled, with no diagnostic and nothing to clear it.
249 mExclusiveDriver.clear();
250}
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
Definition manager.h:327
fl::string mExclusiveDriver
Exclusive driver name (empty if no exclusive mode)
Definition manager.h:336
bool waitForReady(u32 timeoutMs=1000) FL_NO_EXCEPT
Wait for all drivers to become READY.
#define FL_DBG
Definition log.h:553

References FL_DBG, fl::FL_NO_EXCEPT, mDrivers, mExclusiveDriver, and waitForReady().

Referenced by CFastLED::clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: