arduino-esp32/cores/esp32/main.cpp
me-no-dev 1d1aeecde2 simplify WiFi boot procedure to prepare for on-demand stack load
currently ```esp_wifi_init``` have to be called in ```app_main``` or
WiFi will fail to boot. When possible to boot later, code will be moved
into ```_esp_wifi_start``` to be executed when necessary
2016-11-28 00:50:21 +02:00

30 lines
510 B
C++

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp32-hal.h"
#if CONFIG_AUTOSTART_ARDUINO
extern "C" void initArduino();
extern void loop();
extern void setup();
void loopTask(void *pvParameters)
{
bool setup_done = false;
for(;;) {
if(!setup_done) {
setup();
setup_done = true;
}
loop();
}
}
extern "C" void app_main()
{
initArduino();
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
}
#endif