MCPcopy Create free account
hub / github.com/FastLED/FastLED / poll

Method poll

src/fl/channels/manager.cpp.hpp:493–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493IChannelDriver::DriverState ChannelManager::poll() {
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();
502 if (result.state == IChannelDriver::DriverState::BUSY) {
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}
526
527bool ChannelManager::waitForReady(u32 timeoutMs) {
528 bool ok = waitForCondition([this]() {

Callers

nothing calls this directly

Calls 2

DriverStateClass · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected