FastLED 3.10.9
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 234 of file manager.cpp.hpp.

234 {
235 FL_DBG("ChannelManager: Waiting for all drivers to become READY before clearing");
236
237 // Wait for all drivers to become READY before clearing
238 // This prevents clearing drivers that are still transmitting
239 waitForReady();
240
241 FL_DBG("ChannelManager: Clearing " << mDrivers.size() << " drivers");
242
243 for (auto& entry : mDrivers) {
244 if (entry.driver) {
245 entry.driver->setPollNeededCallback(IChannelDriver::PollNeededCallback());
246 }
247 }
248
249 // Clear all drivers (shared_ptr handles cleanup automatically)
250 mDrivers.clear();
251
252 // Drop the exclusive-driver filter along with the registry it refers to.
253 // Leaving it set would name a driver that no longer exists, and
254 // addDriver() consults it -- so every driver registered afterwards would
255 // arrive silently disabled, with no diagnostic and nothing to clear it.
256 mExclusiveDriver.clear();
257}
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: