FastLED 3.10.8
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 529 of file manager.cpp.hpp.

529 {
530 // Poll all registered drivers and return aggregate state
531 // Priority order: ERROR > BUSY > DRAINING > READY
532 bool anyBusy = false;
533 bool anyDraining = false;
534 fl::string firstError;
535
536 for (auto& entry : mDrivers) {
537 IChannelDriver::DriverState result = entry.driver->poll();
539 anyBusy = true;
540 } else if (result.state == IChannelDriver::DriverState::DRAINING) {
541 anyDraining = true;
542 }
543 // Capture first error encountered
544 if (result.state == IChannelDriver::DriverState::ERROR && firstError.empty()) {
545 firstError = result.error;
546 }
547 }
548
549 // Return error if any driver reported error
550 if (!firstError.empty()) {
551 return IChannelDriver::DriverState(IChannelDriver::DriverState::ERROR, firstError);
552 }
553
554 if (anyBusy) {
555 return IChannelDriver::DriverState(IChannelDriver::DriverState::BUSY);
556 }
557 if (anyDraining) {
558 return IChannelDriver::DriverState(IChannelDriver::DriverState::DRAINING);
559 }
560 return IChannelDriver::DriverState(IChannelDriver::DriverState::READY);
561}
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
Definition manager.h:327
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, fl::FL_NO_EXCEPT, 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: