Increase task wdt timeout for ESP32/ESP32-C3 (#2096)

This commit is contained in:
Stefan Agner 2021-08-10 11:10:52 +02:00 committed by GitHub
parent 6a2f0f5143
commit f94c221a9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 6 deletions

View file

@ -53,6 +53,7 @@ void Application::setup() {
}
this->app_state_ = new_app_state;
yield();
this->feed_wdt();
} while (!component->can_proceed());
}
@ -117,12 +118,7 @@ void ICACHE_RAM_ATTR HOT Application::feed_wdt() {
static uint32_t LAST_FEED = 0;
uint32_t now = millis();
if (now - LAST_FEED > 3) {
#ifdef ARDUINO_ARCH_ESP8266
ESP.wdtFeed();
#endif
#ifdef ARDUINO_ARCH_ESP32
yield();
#endif
this->feed_wdt_arch_();
LAST_FEED = now;
#ifdef USE_STATUS_LED
if (status_led::global_status_led != nullptr) {

View file

@ -250,6 +250,8 @@ class Application {
void calculate_looping_components_();
void feed_wdt_arch_();
std::vector<Component *> components_{};
std::vector<Component *> looping_components_{};

View file

@ -0,0 +1,21 @@
#include "esphome/core/application.h"
#ifdef ARDUINO_ARCH_ESP32
namespace esphome {
static const char *const TAG = "app_esp32";
void ICACHE_RAM_ATTR HOT Application::feed_wdt_arch_() {
#if CONFIG_ARDUINO_RUNNING_CORE == 0
#ifdef CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0
// ESP32 uses "Task Watchdog" which is hooked to the FreeRTOS idle task.
// To cause the Watchdog to be triggered we need to put the current task
// to sleep to get the idle task scheduled.
delay(1);
#endif
#endif
}
} // namespace esphome
#endif

View file

@ -0,0 +1,12 @@
#include "esphome/core/application.h"
#ifdef ARDUINO_ARCH_ESP8266
namespace esphome {
static const char *const TAG = "app_esp8266";
void ICACHE_RAM_ATTR HOT Application::feed_wdt_arch_() { ESP.wdtFeed(); }
} // namespace esphome
#endif