Hello has somebody managed a stable wifi connection that handles all kind of issues like power loss, router reboot, wifi loss and manage the machine to reconnect properly? This code wont work in a stable way:
void setup() {
wifiConnect();
}
void loop(){
wifiConnect();
}
void wifiConnect(){
if(WiFi.status() != WL_CONNECTED) {
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
// attempt to connect to Wifi network:
while(WiFi.status() != WL_CONNECTED) {
// Connect to WPA/WPA2 network.
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
}
This is very stable and easy on a raspberry, because the pi handles it but on esp32 the sample codes do not handle at all the issues that can arise. And if you have issues you cannot debug, very frustrating.