move tcp and wifi loop inits to _start so _connect can handle only wifi config/connect

This commit is contained in:
Morgan Allen 2018-09-21 21:33:36 -07:00
parent 8655f986ac
commit 8ff9dcc43d
1 changed files with 3 additions and 3 deletions

View File

@ -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;