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 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();