From e9d75a08b8ad59508a70441fad1cbba90ec0dcaf Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 10 Apr 2020 10:06:11 -0500 Subject: [PATCH] Disables usermode restore I may add optionals later for this, right now sta mode is the default, and sta mode will always be the only mode on after using WM, if you were using ap mode you have to turn it back on yourself until I have a better solution or documentation. --- WiFiManager.cpp | 4 ++-- WiFiManager.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 930baf2..f923d47 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -216,7 +216,7 @@ WiFiManager::~WiFiManager() { void WiFiManager::_begin(){ if(_hasBegun) return; _hasBegun = true; - _usermode = WiFi.getMode(); + // _usermode = WiFi.getMode(); #ifndef ESP32 WiFi.persistent(false); // disable persistent so scannetworks and mode switching do not cause overwrites @@ -262,7 +262,7 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) { if(esp32persistent) WiFi.persistent(false); // disable persistent for esp32 after esp_wifi_start or else saves wont work #endif - _usermode = WIFI_STA; + _usermode = WIFI_STA; // When using autoconnect , assume the user wants sta mode on permanently. // no getter for autoreconnectpolicy before this // https://github.com/esp8266/Arduino/pull/4359 diff --git a/WiFiManager.h b/WiFiManager.h index 0a73eda..7ad1628 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -335,7 +335,7 @@ class WiFiManager unsigned long _saveTimeout = 0; // ms stop trying to connect to ap on saves, in case bugs in esp waitforconnectresult unsigned long _configPortalStart = 0; // ms config portal start time (updated for timeouts) unsigned long _webPortalAccessed = 0; // ms last web access time - WiFiMode_t _usermode = WIFI_OFF; + WiFiMode_t _usermode = WIFI_STA; // Default user mode String _wifissidprefix = FPSTR(S_ssidpre); // auto apname prefix prefix+chipid uint8_t _lastconxresult = WL_IDLE_STATUS; int _numNetworks = 0;