From d27fa7df618e7eaad7f54e26aec635e274dc2224 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 9 Apr 2018 19:16:12 -0500 Subject: [PATCH] hotfixing #425 this is a hotfix, there are numerous issues with this, development branch already addressed all of them. --- WiFiManager.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 1e6d805..ec235e8 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -197,9 +197,20 @@ boolean WiFiManager::startConfigPortal() { } boolean WiFiManager::startConfigPortal(char const *apName, char const *apPassword) { - //setup AP - WiFi.mode(WIFI_AP_STA); - DEBUG_WM(F("SET AP STA")); + + if(!WiFi.isConnected()){ + WiFi.persistent(false); + // disconnect sta, start ap + WiFi.disconnect(); // this alone is not enough to stop the autoconnecter + WiFi.mode(WIFI_AP); + WiFi.persistent(true); + } + else { + //setup AP + WiFi.mode(WIFI_AP_STA); + DEBUG_WM(F("SET AP STA")); + } + _apName = apName; _apPassword = apPassword;