FastLED 3.9.15
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 493 of file manager.cpp.hpp.

493 {
494 // Poll all registered drivers and return aggregate state
495 // Priority order: ERROR > BUSY > DRAINING > READY
496 bool anyBusy = false;
497 bool anyDraining = false;
498 fl::string firstError;
499
500 for (auto& entry : mDrivers) {
501 IChannelDriver::DriverState result = entry.driver->poll();
503 anyBusy = true;
504 } else if (result.state == IChannelDriver::DriverState::DRAINING) {
505 anyDraining = true;
506 }
507 // Capture first error encountered
508 if (result.state == IChannelDriver::DriverState::ERROR && firstError.empty()) {
509 firstError = result.error;
510 }
511 }
512
513 // Return error if any driver reported error
514 if (!firstError.empty()) {
515 return IChannelDriver::DriverState(IChannelDriver::DriverState::ERROR, firstError);
516 }
517
518 if (anyBusy) {
519 return IChannelDriver::DriverState(IChannelDriver::DriverState::BUSY);
520 }
521 if (anyDraining) {
522 return IChannelDriver::DriverState(IChannelDriver::DriverState::DRAINING);
523 }
524 return IChannelDriver::DriverState(IChannelDriver::DriverState::READY);
525}
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
Definition manager.h:287
bool empty() const FL_NOEXCEPT
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:167
@ DRAINING
All channels submitted; still transmitting.
Definition driver.h:169
@ ERROR
Driver encountered an error.
Definition driver.h:170
@ BUSY
Active: channels transmitting or queued.
Definition driver.h:168

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: