split to scan and connect function

This commit is contained in:
Morgan Allen 2018-10-09 21:23:08 -07:00
parent db94a61575
commit 48d61d1807

View file

@ -96,13 +96,7 @@ uint8_t wifi_manager_add_ap(char *ssid, char *password) {
return ap_store.count; return ap_store.count;
}; };
void wifi_manager_connect() { void wifi_manager_scan() {
ESP_ERROR_CHECK(esp_wifi_start());
wifi_config_t wifi_config = {
.sta = {
}
};
wifi_scan_config_t scan_config = { 0 }; wifi_scan_config_t scan_config = { 0 };
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, false)); ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, false));
@ -110,8 +104,13 @@ void wifi_manager_connect() {
ESP_LOGI(TAG, "setting WIFI_SCANNING bit"); ESP_LOGI(TAG, "setting WIFI_SCANNING bit");
xEventGroupSetBits(wm_event_group, WIFI_SCANNING); xEventGroupSetBits(wm_event_group, WIFI_SCANNING);
xEventGroupClearBits(wm_event_group, WIFI_IDLE); xEventGroupClearBits(wm_event_group, WIFI_IDLE);
};
return; void wifi_manager_connect() {
wifi_config_t wifi_config = {
.sta = {
}
};
ESP_LOGI(TAG, "connecting to AP %d of %d", ap_store.last + 1, ap_store.count); ESP_LOGI(TAG, "connecting to AP %d of %d", ap_store.last + 1, ap_store.count);