move CONNECTING bitsetting to _connect and reset _IDLE

This commit is contained in:
Morgan Allen 2018-09-21 23:22:54 -07:00
parent 7e6c9036b4
commit 2dc81950d4

View file

@ -106,7 +106,10 @@ void wifi_manager_connect() {
}
};
ESP_LOGI(TAG, "connecting to AP %d of %d", ap_store.last, ap_store.count);
xEventGroupSetBits(wm_event_group, WIFI_CONNECTING);
xEventGroupClearBits(wm_event_group, WIFI_IDLE);
ESP_LOGI(TAG, "connecting to AP %d of %d", ap_store.last + 1, ap_store.count);
memcpy((char *)&wifi_config.sta.ssid, ap_store.aps[ap_store.last].ssid, strlen(ap_store.aps[ap_store.last].ssid) + 1);
memcpy((char *)&wifi_config.sta.password, ap_store.aps[ap_store.last].password, strlen(ap_store.aps[ap_store.last].password) + 1);
@ -131,8 +134,6 @@ void wifi_manager_main_loop() {
if(ev_bits & AP_AVAILABLE && (ev_bits & WIFI_CONNECTING) == 0) {
ESP_LOGI(TAG, "AP Available, starting WiFi connect");
xEventGroupSetBits(wm_event_group, WIFI_CONNECTING);
wifi_manager_connect();
}