Skip to content

Commit

Permalink
allways save parameters. close #11
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Apr 28, 2017
1 parent 7906cfc commit ea50214
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ESP8266EASTRON/general.ino
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,17 @@ void wifiSetup(bool withAutoConnect) {
wifiManager.setConfigPortalTimeout(180);
// set config save notify callback
wifiManager.setSaveConfigCallback(saveConfigCallback);
wifiManager.setBreakAfterConfig(true);

bool needsRestart = false;
if (withAutoConnect){
if (!wifiManager.autoConnect()) {
if (shouldSaveConfig)
DEBUG_PRINTLN("shouldSaveConfig"); // TODO!!!!!!!!!!!!!!!!!! #11
restart();
needsRestart = true;
}
} else {
String ssid = SF("ESP") + String(ESP.getChipId());
if (!wifiManager.startConfigPortal(ssid.c_str())) {
if (shouldSaveConfig)
DEBUG_PRINTLN("shouldSaveConfig"); // TODO!!!!!!!!!!!!!!!!!!
restart();
needsRestart = true;
}
}
if (shouldSaveConfig) {
Expand All @@ -224,6 +222,10 @@ void wifiSetup(bool withAutoConnect) {
params.SaveToEEPROM();
}

if (needsRestart) {
restart();
}

ticker.detach();
}

Expand Down

0 comments on commit ea50214

Please sign in to comment.