mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Increase task wdt timeout for ESP32/ESP32-C3 (#2096)
This commit is contained in:
parent
6a2f0f5143
commit
f94c221a9a
4 changed files with 37 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -250,6 +250,8 @@ class Application {
|
|||
|
||||
void calculate_looping_components_();
|
||||
|
||||
void feed_wdt_arch_();
|
||||
|
||||
std::vector<Component *> components_{};
|
||||
std::vector<Component *> looping_components_{};
|
||||
|
||||
|
|
21
esphome/core/application_esp32.cpp
Normal file
21
esphome/core/application_esp32.cpp
Normal 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
|
12
esphome/core/application_esp8266.cpp
Normal file
12
esphome/core/application_esp8266.cpp
Normal 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
|
Loading…
Reference in a new issue