FastLED 3.10.10
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 550 of file manager.cpp.hpp.

550 {
551 // Poll all registered drivers and return aggregate state
552 // Priority order: ERROR > BUSY > DRAINING > READY
553 bool anyBusy = false;
554 bool anyDraining = false;
555 fl::string firstError;
556
557 for (auto& entry : mDrivers) {
558 IChannelDriver::DriverState result = entry.driver->poll();
560 anyBusy = true;
561 } else if (result.state == IChannelDriver::DriverState::DRAINING) {
562 anyDraining = true;
563 }
564 // Capture first error encountered
565 if (result.state == IChannelDriver::DriverState::ERROR && firstError.empty()) {
566 firstError = result.error;
567 }
568 }
569
570 // Return error if any driver reported error
571 if (!firstError.empty()) {
572 return IChannelDriver::DriverState(IChannelDriver::DriverState::ERROR, firstError);
573 }
574
575 if (anyBusy) {
576 return IChannelDriver::DriverState(IChannelDriver::DriverState::BUSY);
577 }
578 if (anyDraining) {
579 return IChannelDriver::DriverState(IChannelDriver::DriverState::DRAINING);
580 }
581 return IChannelDriver::DriverState(IChannelDriver::DriverState::READY);
582}
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
Definition manager.h:330
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:171
@ DRAINING
All channels submitted; still transmitting.
Definition driver.h:173
@ ERROR
Driver encountered an error.
Definition driver.h:174
@ BUSY
Active: channels transmitting or queued.
Definition driver.h:172

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 waitForState().

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