Restart ESP when Wifi connection fails

This commit is contained in:
technyon
2022-04-08 21:36:02 +02:00
parent 416fd5d81f
commit 47b13ff175

View File

@@ -29,13 +29,13 @@ void Network::initialize()
bool res = wm.autoConnect(); // password protected ap
if(!res) {
Serial.println(F("Failed to connect"));
return;
// ESP.restart();
Serial.println(F("Failed to connect. Wait for ESP restart."));
delay(10000);
ESP.restart();
}
else {
//if you get here you have connected to the WiFi
Serial.println(F("connected...yeey :)"));
Serial.print(F("WiFi connected."));
Serial.println(WiFi.localIP().toString());
}
const char* brokerAddr = _preferences->getString(preference_mqtt_broker).c_str();