8dc70e0add
This reverts commit 4b3f5c8ed4
.
36 lines
725 B
C++
36 lines
725 B
C++
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_task_wdt.h"
|
|
#include "Arduino.h"
|
|
|
|
#ifndef CONFIG_ARDUINO_LOOP_STACK_SIZE
|
|
#define CONFIG_ARDUINO_LOOP_STACK_SIZE 8192
|
|
#endif
|
|
|
|
TaskHandle_t loopTaskHandle = NULL;
|
|
|
|
#if CONFIG_AUTOSTART_ARDUINO
|
|
|
|
bool loopTaskWDTEnabled;
|
|
|
|
void loopTask(void *pvParameters)
|
|
{
|
|
setup();
|
|
for(;;) {
|
|
if(loopTaskWDTEnabled){
|
|
esp_task_wdt_reset();
|
|
}
|
|
loop();
|
|
if (serialEventRun) serialEventRun();
|
|
}
|
|
}
|
|
|
|
extern "C" void app_main()
|
|
{
|
|
loopTaskWDTEnabled = false;
|
|
initArduino();
|
|
xTaskCreateUniversal(loopTask, "loopTask", CONFIG_ARDUINO_LOOP_STACK_SIZE, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE);
|
|
}
|
|
|
|
#endif
|