Added timeout check at wifi connect

This commit is contained in:
Magnus
2021-03-29 18:09:08 +02:00
parent e15f01d290
commit fb9fde73a4
8 changed files with 48 additions and 42 deletions

View File

@ -75,13 +75,18 @@ bool Wifi::connect( bool showPortal ) {
}
}
// TODO: Add timeout after x retries to not end up in forever loop.
// Connect to wifi
int i = 0;
WiFi.begin();
while( WiFi.status() != WL_CONNECTED ) {
delay(100);
Serial.print( "." );
if( i++ > 100 ) {
LittleFS.end();
ESP.reset();
}
}
Serial.print( CR );
connectedFlag = true;