diff options
-rw-r--r-- | control/actions.hpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/control/actions.hpp b/control/actions.hpp index c7356ab..b079bf4 100644 --- a/control/actions.hpp +++ b/control/actions.hpp @@ -88,27 +88,28 @@ auto count_state_before_speed(size_t count, T&& state, uint64_t speed) speed, state = std::forward<T>(state)](auto& zone, auto& group) { - size_t numAtState = std::count_if( - group.begin(), - group.end(), - [&zone, &state](auto const& entry) + size_t numAtState = 0; + for (auto& entry : group) + { + try { - try - { - return zone.template getPropertyValue<T>( - entry.first, - std::get<intfPos>(entry.second), - std::get<propPos>(entry.second)) == state; - } - catch (const std::out_of_range& oore) + if (zone.template getPropertyValue<T>( + entry.first, + std::get<intfPos>(entry.second), + std::get<propPos>(entry.second)) == state) { - // Default to property not equal when not found - return false; + numAtState++; } - }); - if (numAtState >= count) - { - zone.setSpeed(speed); + } + catch (const std::out_of_range& oore) + { + // Default to property not equal when not found + } + if (numAtState >= count) + { + zone.setSpeed(speed); + break; + } } // Update group's fan control active allowed based on action results zone.setActiveAllow(&group, !(numAtState >= count)); |