diff --git a/ESPTest/src/main.cpp b/ESPTest/src/main.cpp index 26b28d0..fee8ca1 100644 --- a/ESPTest/src/main.cpp +++ b/ESPTest/src/main.cpp @@ -2,6 +2,16 @@ #include "WiFi.h" #include "theSecrets.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "nvs_flash.h" +#include "lwip/err.h" +#include "lwip/sockets.h" +#include "lwip/sys.h" +#include + void connectToWifi() { WiFi.begin(ssid, psk); @@ -34,13 +44,29 @@ void handle_wifi_events(WiFiEvent_t event, WiFiEventInfo_t info) } } -void setup() +void setup_wifi() { WiFi.mode(WIFI_STA); WiFi.onEvent(handle_wifi_events, ARDUINO_EVENT_MAX); connectToWifi(); } +static void intercept_task(void *pvParameters) +{ + Serial.println("Intercept"); + vTaskDelete(NULL); +} + +void setup() +{ + ESP_ERROR_CHECK(nvs_flash_init()); + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + Serial.begin(115200); + setup_wifi(); + xTaskCreate(intercept_task, "intercept", 4096, (void *)AF_INET, 5, NULL); +} + void loop() { } \ No newline at end of file