Restart ESP when Wifi connection fails
This commit is contained in:
10
Network.cpp
10
Network.cpp
@@ -29,13 +29,13 @@ void Network::initialize()
|
|||||||
bool res = wm.autoConnect(); // password protected ap
|
bool res = wm.autoConnect(); // password protected ap
|
||||||
|
|
||||||
if(!res) {
|
if(!res) {
|
||||||
Serial.println(F("Failed to connect"));
|
Serial.println(F("Failed to connect. Wait for ESP restart."));
|
||||||
return;
|
delay(10000);
|
||||||
// ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//if you get here you have connected to the WiFi
|
Serial.print(F("WiFi connected."));
|
||||||
Serial.println(F("connected...yeey :)"));
|
Serial.println(WiFi.localIP().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* brokerAddr = _preferences->getString(preference_mqtt_broker).c_str();
|
const char* brokerAddr = _preferences->getString(preference_mqtt_broker).c_str();
|
||||||
|
|||||||
Reference in New Issue
Block a user