ESPAsyncWiFiManager icon indicating copy to clipboard operation
ESPAsyncWiFiManager copied to clipboard

dont save ssid and pass

Open BDskii opened this issue 3 years ago • 1 comments

for save wifi config must call wifi_station_set_config but in ESP8266WiFiSTA.cpp : if(WiFi._persistent) { wifi_station_set_config(&conf); } else { wifi_station_set_config_current(&conf); } and default _persistent == false

fo fix it need add WiFi.persistent(true); before if (connectWifi(_ssid, _pass) == WL_CONNECTED) and WiFi.persistent(false); after

BDskii avatar Dec 05 '21 15:12 BDskii

@BDskii thank you for providing the solution. Let me restate the issue and solution. Same problem like issue #83 https://github.com/alanswx/ESPAsyncWiFiManager/issues/83 Problem: When a connection to the WiFi network can't be established the captive portal will be displayed. After selecting a WiFi network and providing the correct password, the device is connecting to the network but the credentials are not saved. After reboot, the captive portal will start again as the credentials are missing. Solution: Update file ESPAsyncWiFiManager.cpp, line 646 in function "boolean AsyncWiFiManager::startConfigPortal(char const *apName, char const *apPassword)"

// using user-provided _ssid, _pass in place of system-stored ssid and pass WiFi.persistent(true); // update according to BDskii - see last line as well if (connectWifi(_ssid, _pass) == WL_CONNECTED) { // connected WiFi.mode(WIFI_STA); // notify that configuration has changed and any optional parameters should be saved if (_savecallback != NULL) { // TODO: check if any custom parameters actually exist, and check if they really changed maybe _savecallback(); } break; } else { DEBUG_WM(F("Failed to connect")); } WiFi.persistent(false); // update according to BDskii

ThomasH-W avatar Dec 30 '21 18:12 ThomasH-W