Skip to content

Commit

Permalink
Merge branch 'hotfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
tablatronix committed Aug 5, 2018
2 parents 6a13968 + 704a7ae commit dd7a686
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -297,11 +308,13 @@ int WiFiManager::connectWifi(String ssid, String pass) {
DEBUG_WM ("Connection result: ");
DEBUG_WM ( connRes );
//not connected, WPS enabled, no pass - first attempt
#ifdef NO_EXTRA_4K_HEAP
if (_tryWPS && connRes != WL_CONNECTED && pass == "") {
startWPS();
//should be connected at the end of WPS
connRes = waitForConnectResult();
}
#endif
return connRes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void setup() {
} else {
Serial.println("failed to load json config");
}
configFile.close();
}
}
} else {
Expand Down

0 comments on commit dd7a686

Please sign in to comment.