mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 13:24:15 +01:00
Fix merge
This commit is contained in:
parent
347393b864
commit
a943bc6c80
@ -105,42 +105,6 @@ void Application::loop() {
|
|||||||
this->dump_config_at_++;
|
this->dump_config_at_++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Application::loop() {
|
|
||||||
uint32_t new_app_state = 0;
|
|
||||||
const uint32_t start = millis();
|
|
||||||
for (Component *component : this->components_) {
|
|
||||||
if (!component->is_failed()) {
|
|
||||||
component->call_loop();
|
|
||||||
}
|
|
||||||
new_app_state |= component->get_component_state();
|
|
||||||
this->app_state_ |= new_app_state;
|
|
||||||
this->feed_wdt();
|
|
||||||
}
|
|
||||||
this->app_state_ = new_app_state;
|
|
||||||
const uint32_t end = millis();
|
|
||||||
if (end - start > 200) {
|
|
||||||
ESP_LOGV(TAG, "A component took a long time in a loop() cycle (%.1f s).", (end - start) / 1e3f);
|
|
||||||
ESP_LOGV(TAG, "Components should block for at most 20-30ms in loop().");
|
|
||||||
ESP_LOGV(TAG, "This will become a warning soon.");
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint32_t now = millis();
|
|
||||||
|
|
||||||
if (HighFrequencyLoopRequester::is_high_frequency()) {
|
|
||||||
yield();
|
|
||||||
} else {
|
|
||||||
uint32_t delay_time = this->loop_interval_;
|
|
||||||
if (now - this->last_loop_ < this->loop_interval_)
|
|
||||||
delay_time = this->loop_interval_ - (now - this->last_loop_);
|
|
||||||
delay(delay_time);
|
|
||||||
}
|
|
||||||
this->last_loop_ = now;
|
|
||||||
|
|
||||||
if (this->dump_config_scheduled_) {
|
|
||||||
this->dump_config();
|
|
||||||
this->dump_config_scheduled_ = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICACHE_RAM_ATTR HOT Application::feed_wdt() {
|
void ICACHE_RAM_ATTR HOT Application::feed_wdt() {
|
||||||
static uint32_t LAST_FEED = 0;
|
static uint32_t LAST_FEED = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user