FastLED 3.10.6
Loading...
Searching...
No Matches

◆ poll()

IChannelDriver::DriverState fl::ChannelManager::poll ( )

Poll all registered drivers and return aggregate state.

Returns
Aggregate state (READY if all ready, BUSY if any busy, ERROR if any error)
Note
This is NOT an IChannelDriver override - it's a diagnostic/test helper
Polls all drivers and returns the "worst" state (ERROR > BUSY > READY)

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

519 {
520 // Poll all registered drivers and return aggregate state
521 // Priority order: ERROR > BUSY > DRAINING > READY
522 bool anyBusy = false;
523 bool anyDraining = false;
524 fl::string firstError;
525
526 for (auto& entry : mDrivers) {
527 IChannelDriver::DriverState result = entry.driver->poll();
529 anyBusy = true;
530 } else if (result.state == IChannelDriver::DriverState::DRAINING) {
531 anyDraining = true;
532 }
533 // Capture first error encountered
534 if (result.state == IChannelDriver::DriverState::ERROR && firstError.empty()) {
535 firstError = result.error;
536 }
537 }
538
539 // Return error if any driver reported error
540 if (!firstError.empty()) {
541 return IChannelDriver::DriverState(IChannelDriver::DriverState::ERROR, firstError);
542 }
543
544 if (anyBusy) {
545 return IChannelDriver::DriverState(IChannelDriver::DriverState::BUSY);
546 }
547 if (anyDraining) {
548 return IChannelDriver::DriverState(IChannelDriver::DriverState::DRAINING);
549 }
550 return IChannelDriver::DriverState(IChannelDriver::DriverState::READY);
551}
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
Definition manager.h:321
bool empty() const FL_NO_EXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
@ READY
Hardware idle; ready to accept new transmissions.
Definition driver.h:170
@ DRAINING
All channels submitted; still transmitting.
Definition driver.h:172
@ ERROR
Driver encountered an error.
Definition driver.h:173
@ BUSY
Active: channels transmitting or queued.
Definition driver.h:171

References fl::IChannelDriver::DriverState::BUSY, fl::IChannelDriver::DriverState::DRAINING, fl::basic_string::empty(), fl::IChannelDriver::DriverState::ERROR, mDrivers, and fl::IChannelDriver::DriverState::READY.

Referenced by waitForReady(), and waitForReadyOrDraining().

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