Skip to content

Commit

Permalink
Cleanup wifi startup
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussy committed Apr 4, 2020
1 parent 521ad6a commit f23e69c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,20 @@ void doWiFi(bool ignore = false) { // Handle WiFi and optionally ignore current
ESP.restart();
_delay(1000); // Just a hack to give it time to reset
} else {
// We finished with portal (configured), do we need this?
// We finished with portal (configured)
WiFi.mode(WIFI_STA); // Explicitly set mode, esp defaults to STA+AP
WiFi.setSleepMode(WIFI_NONE_SLEEP); // Make sure sleep is disabled
if (blinker.active()) blinker.detach(); // Turn off blinker
digitalWrite(LED, HIGH); // Turn off LED
WiFi.hostname(config.hostname);
}
}

WiFi.mode(WIFI_STA); // Explicitly set mode, esp defaults to STA+AP
WiFi.setSleepMode(WIFI_NONE_SLEEP); // Make sure sleep is disabled

if (blinker.active()) blinker.detach(); // Turn off blinker
digitalWrite(LED, HIGH); // Turn off LED

// if (shouldSaveConfig) { // Save configuration
// Log.notice(F("Saving configuration." CR));
//
// }

WiFi.hostname(config.hostname);

Log.notice(F("Connected. IP address: %s." CR), WiFi.localIP().toString().c_str());
if (blinker.active()) blinker.detach(); // Turn off blinker
digitalWrite(LED, HIGH); // Turn off LED
Expand Down

0 comments on commit f23e69c

Please sign in to comment.