From a98f86f72b1eca9a4b9a87bb89e1991e29948912 Mon Sep 17 00:00:00 2001 From: mroavi Date: Sat, 4 Jun 2016 03:36:49 +0200 Subject: [PATCH] Change to mode STATIONAP_MODE at startup only if STA_SSID and STA_PASS are defined. --- esp-link/cgiwifi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index 6a7c530..9dc694a 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -836,7 +836,7 @@ void ICACHE_FLASH_ATTR wifiInit() { // If STA is enabled switch to STA+AP to allow for recovery, it will then switch to STA-only // once it gets an IP address - wifi_set_opmode(3); + if (x == 1) wifi_set_opmode(3); // Call both STATION and SOFTAP default config wifi_station_get_config_default(&stconf); @@ -851,6 +851,8 @@ void ICACHE_FLASH_ATTR wifiInit() { os_strncpy((char*)stconf.ssid, VERS_STR(STA_SSID), 32); os_strncpy((char*)stconf.password, VERS_STR(STA_PASS), 64); + wifi_set_opmode(3); + DBG("Wifi pre-config trying to connect to AP %s pw %s\n",(char*)stconf.ssid, (char*)stconf.password); // wifi_set_phy_mode(2); // limit to 802.11b/g 'cause n is flaky