From 8ff9dcc43dfe809873e715037fe5e38d797ec363 Mon Sep 17 00:00:00 2001 From: Morgan Allen Date: Fri, 21 Sep 2018 21:33:36 -0700 Subject: [PATCH] move tcp and wifi loop inits to _start so _connect can handle only wifi config/connect --- main/esp32-wifi-manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/esp32-wifi-manager.c b/main/esp32-wifi-manager.c index 86e802e..eefaa49 100644 --- a/main/esp32-wifi-manager.c +++ b/main/esp32-wifi-manager.c @@ -92,9 +92,6 @@ uint8_t wifi_manager_add_ap(char *ssid, char *password) { }; void wifi_manager_connect() { - tcpip_adapter_init(); - ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL) ); - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); wifi_config_t wifi_config = { @@ -199,6 +196,9 @@ EventGroupHandle_t wifi_manager_start() { wifi_manager_load_config(); + tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL) ); + xTaskCreate(&wifi_manager_main_loop, "wm_main_loop", 4096, NULL, 6, NULL); return wm_event_group;