Skip to content

Commit 81844f5

Browse files
committed
Add API to feed the loop WDT (call from loop only)
1 parent f7cf583 commit 81844f5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

cores/esp32/esp32-hal-cpu.c

-2
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){
131131
uint32_t capb, apb;
132132
//Get XTAL Frequency and calculate min CPU MHz
133133
rtc_xtal_freq_t xtal = rtc_clk_xtal_freq_get();
134-
uint32_t min_cpu_mhz = 10;
135134
if(xtal > RTC_XTAL_FREQ_AUTO){
136135
if(xtal < RTC_XTAL_FREQ_40M) {
137-
min_cpu_mhz = xtal / 2; //13Mhz for 26Mhz XTAL
138136
if(cpu_freq_mhz <= xtal && cpu_freq_mhz != xtal && cpu_freq_mhz != (xtal/2)){
139137
log_e("Bad frequency: %u MHz! Options are: 240, 160, 80, %u and %u MHz", cpu_freq_mhz, xtal, xtal/2);
140138
return false;

cores/esp32/esp32-hal-misc.c

+7
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ void disableLoopWDT(){
6969
}
7070
}
7171
}
72+
73+
void feedLoopWDT(){
74+
esp_err_t err = esp_task_wdt_reset();
75+
if(err != ESP_OK){
76+
log_e("Failed to feed WDT! Error: %d", err);
77+
}
78+
}
7279
#endif
7380

7481
void enableCore0WDT(){

cores/esp32/esp32-hal.h

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ float temperatureRead();
7777
//enable/disable WDT for Arduino's setup and loop functions
7878
void enableLoopWDT();
7979
void disableLoopWDT();
80+
//feed WDT for the loop task
81+
void feedLoopWDT();
8082
#endif
8183

8284
//enable/disable WDT for the IDLE task on Core 0 (SYSTEM)

0 commit comments

Comments
 (0)