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
1 changed files with 7 additions and 8 deletions

View File

@ -96,13 +96,7 @@ uint8_t wifi_manager_add_ap(char *ssid, char *password) {
return ap_store.count;
};
void wifi_manager_connect() {
ESP_ERROR_CHECK(esp_wifi_start());
wifi_config_t wifi_config = {
.sta = {
}
};
void wifi_manager_scan() {
wifi_scan_config_t scan_config = { 0 };
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");
xEventGroupSetBits(wm_event_group, WIFI_SCANNING);
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);