add more test ap options

This commit is contained in:
Morgan Allen 2018-09-21 21:30:58 -07:00
parent fb49e95064
commit 3e25c915fa
2 changed files with 21 additions and 1 deletions

12
Kconfig
View file

@ -11,6 +11,18 @@ config WIFI_MANAGER_TEST_AP
config WIFI_MANAGER_TEST_PWD
string "password for test AP"
config WIFI_MANAGER_TEST_AP1
string "ESSID for test AP"
config WIFI_MANAGER_TEST_PWD1
string "password for test AP"
config WIFI_MANAGER_TEST_AP2
string "ESSID for test AP"
config WIFI_MANAGER_TEST_PWD2
string "password for test AP"
config WIFI_MANAGER_MAX_AP
int "Maximum number of APs to store in flash"
default 8

View file

@ -117,11 +117,19 @@ void app_main() {
ESP_LOGI(TAG, "MAC: %X:%X:%X:%X:%X:%X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
wm_event_group = wifi_manager_start();
wifi_manager_reset_store();
if(wifi_manager_ap_count() == 0) {
ESP_LOGI(TAG, "Adding new AP");
if(strlen(CONFIG_WIFI_MANAGER_TEST_AP) > 0)
wifi_manager_add_ap(CONFIG_WIFI_MANAGER_TEST_AP, CONFIG_WIFI_MANAGER_TEST_PWD);
if(strlen(CONFIG_WIFI_MANAGER_TEST_AP1) > 0)
wifi_manager_add_ap(CONFIG_WIFI_MANAGER_TEST_AP1, CONFIG_WIFI_MANAGER_TEST_PWD1);
if(strlen(CONFIG_WIFI_MANAGER_TEST_AP2) > 0)
wifi_manager_add_ap(CONFIG_WIFI_MANAGER_TEST_AP2, CONFIG_WIFI_MANAGER_TEST_PWD2);
} else {
ESP_LOGI(TAG, "Got AP from store, waiting for connection");
}