mirror of
				https://github.com/0xFEEDC0DE64/arduino-esp32.git
				synced 2025-11-04 08:01:38 +01:00 
			
		
		
		
	* Update IDF to 97eecfa and enable reboot on WDT * Add API to enable/disable WDT for Core 1 and Arduino Loop
		
			
				
	
	
		
			37 lines
		
	
	
		
			662 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			662 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "freertos/FreeRTOS.h"
 | 
						|
#include "freertos/task.h"
 | 
						|
#include "esp_task_wdt.h"
 | 
						|
#include "Arduino.h"
 | 
						|
 | 
						|
TaskHandle_t loopTaskHandle = NULL;
 | 
						|
 | 
						|
#if CONFIG_AUTOSTART_ARDUINO
 | 
						|
 | 
						|
#if CONFIG_FREERTOS_UNICORE
 | 
						|
#define ARDUINO_RUNNING_CORE 0
 | 
						|
#else
 | 
						|
#define ARDUINO_RUNNING_CORE 1
 | 
						|
#endif
 | 
						|
 | 
						|
bool loopTaskWDTEnabled;
 | 
						|
 | 
						|
void loopTask(void *pvParameters)
 | 
						|
{
 | 
						|
    setup();
 | 
						|
    for(;;) {
 | 
						|
        if(loopTaskWDTEnabled){
 | 
						|
            esp_task_wdt_reset();
 | 
						|
        }
 | 
						|
        loop();
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
extern "C" void app_main()
 | 
						|
{
 | 
						|
    loopTaskWDTEnabled = false;
 | 
						|
    initArduino();
 | 
						|
    xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, &loopTaskHandle, ARDUINO_RUNNING_CORE);
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |