Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cores/esp32/esp32-hal-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ void yield()
extern TaskHandle_t loopTaskHandle;
extern bool loopTaskWDTEnabled;

void IRAM_ATTR abortLoopDelay(){
if(loopTaskHandle != NULL){
if (xPortInIsrContext()){
vTaskNotifyGiveFromISR(loopTaskHandle, NULL);
} else {
xTaskNotifyGive(loopTaskHandle);
}
}
}

void enableLoopWDT(){
if(loopTaskHandle != NULL){
if(esp_task_wdt_add(loopTaskHandle) != ESP_OK){
Expand Down Expand Up @@ -141,7 +151,7 @@ unsigned long IRAM_ATTR millis()

void delay(uint32_t ms)
{
vTaskDelay(ms / portTICK_PERIOD_MS);
ulTaskNotifyTake(pdTRUE, ms / portTICK_PERIOD_MS);
}

void IRAM_ATTR delayMicroseconds(uint32_t us)
Expand Down
1 change: 1 addition & 0 deletions cores/esp32/esp32-hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void yield(void);
float temperatureRead();

#if CONFIG_AUTOSTART_ARDUINO
void abortLoopDelay();
//enable/disable WDT for Arduino's setup and loop functions
void enableLoopWDT();
void disableLoopWDT();
Expand Down