1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 23:35:47 +00:00
This commit is contained in:
J. Nick Koston
2025-11-04 14:15:23 -06:00
parent ef8b28c594
commit 5ed3e103e3

View File

@@ -100,20 +100,20 @@ template<typename... Ts> class ForCondition : public Condition<Ts...>, public Co
void loop() override { void loop() override {
// Safe to use cached time - only called from Application::loop() // Safe to use cached time - only called from Application::loop()
this->check_internal(App.get_loop_component_start_time()); this->check_internal_(App.get_loop_component_start_time());
} }
float get_setup_priority() const override { return setup_priority::DATA; } float get_setup_priority() const override { return setup_priority::DATA; }
bool check(Ts... x) override { bool check(Ts... x) override {
auto now = millis(); auto now = millis();
if (!this->check_internal(now)) if (!this->check_internal_(now))
return false; return false;
return now - this->last_inactive_ >= this->time_.value(x...); return now - this->last_inactive_ >= this->time_.value(x...);
} }
protected: protected:
bool check_internal(uint32_t now) { bool check_internal_(uint32_t now) {
bool cond = this->condition_->check(); bool cond = this->condition_->check();
if (!cond) if (!cond)
this->last_inactive_ = now; this->last_inactive_ = now;