diff --git a/cores/esp32/esp32-hal-cpu.c b/cores/esp32/esp32-hal-cpu.c index d9e95dc8..c9b8f4c6 100644 --- a/cores/esp32/esp32-hal-cpu.c +++ b/cores/esp32/esp32-hal-cpu.c @@ -131,10 +131,8 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){ uint32_t capb, apb; //Get XTAL Frequency and calculate min CPU MHz rtc_xtal_freq_t xtal = rtc_clk_xtal_freq_get(); - uint32_t min_cpu_mhz = 10; if(xtal > RTC_XTAL_FREQ_AUTO){ if(xtal < RTC_XTAL_FREQ_40M) { - min_cpu_mhz = xtal / 2; //13Mhz for 26Mhz XTAL if(cpu_freq_mhz <= xtal && cpu_freq_mhz != xtal && cpu_freq_mhz != (xtal/2)){ log_e("Bad frequency: %u MHz! Options are: 240, 160, 80, %u and %u MHz", cpu_freq_mhz, xtal, xtal/2); return false; diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 06ed677d..27f5ad23 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -69,6 +69,13 @@ void disableLoopWDT(){ } } } + +void feedLoopWDT(){ + esp_err_t err = esp_task_wdt_reset(); + if(err != ESP_OK){ + log_e("Failed to feed WDT! Error: %d", err); + } +} #endif void enableCore0WDT(){ diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 36ffccac..ef87a044 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -77,6 +77,8 @@ float temperatureRead(); //enable/disable WDT for Arduino's setup and loop functions void enableLoopWDT(); void disableLoopWDT(); +//feed WDT for the loop task +void feedLoopWDT(); #endif //enable/disable WDT for the IDLE task on Core 0 (SYSTEM)