FIx esp32 updates

Webserver now builtin to esp32 lib, esp32 persistent still not implemented properly, fixes erase again, fixes save again
This commit is contained in:
Shawn A
2018-06-27 16:19:12 -05:00
parent 94115006f6
commit 8d7da2fd8b
3 changed files with 11 additions and 5 deletions
+9 -1
View File
@@ -165,6 +165,7 @@ WiFiManager::~WiFiManager() {
if (_params != NULL){
DEBUG_WM(DEBUG_DEV,F("freeing allocated params!"));
free(_params);
_params = NULL;
}
DEBUG_WM(DEBUG_DEV,F("unloading"));
@@ -173,7 +174,10 @@ WiFiManager::~WiFiManager() {
void WiFiManager::_begin(){
if(_hasBegun) return;
_usermode = WiFi.getMode();
#ifndef ESP32
WiFi.persistent(false); // disable persistent so scannetworks and mode switching do not cause overwrites
#endif
}
void WiFiManager::_end(){
@@ -206,6 +210,10 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
return false;
}
#ifdef ESP32
if(esp32persistent) WiFi.persistent(false); // disable persistent for esp32 after esp_wifi_start or else saves wont work
#endif
_usermode = WIFI_STA;
// no getter for autoreconnectpolicy before this
@@ -2362,7 +2370,7 @@ bool WiFiManager::WiFi_eraseConfig() {
bool ret;
WiFi.mode(WIFI_AP_STA); // cannot erase if not in STA mode !
WiFi.persistent(true);
ret = WiFi.disconnect(true);
ret = WiFi.disconnect(true,true);
WiFi.persistent(false);
return ret;
#endif