File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -212,15 +212,28 @@ void wifiUpdate()
212212 {
213213 wifiLastConnectionAttempt = millis ();
214214
215- if (wifiConnectLimitReached ( ) == false ) // Increases wifiConnectionAttemptTimeout
215+ if (wifiConnect ( 10000 ) == true ) // Attempt to connect to any SSID on settings list
216216 {
217- if ( wifiConnect ( 10000 ) == true ) // Attempt to connect to any SSID on settings list
218- wifiSetState (WIFI_CONNECTED);
217+
218+ wifiSetState (WIFI_CONNECTED);
219219 }
220220 else
221221 {
222- // paintWiFiFail(4000, true); //TODO
223- wifiStop (); // Move back to WIFI_OFF
222+ // We failed to connect
223+
224+ if (wifiConnectLimitReached () == false ) // Increases wifiConnectionAttemptTimeout
225+ {
226+ if (wifiConnectionAttemptTimeout / 1000 < 120 )
227+ systemPrintf (" Next WiFi attempt in %d seconds.\r\n " , wifiConnectionAttemptTimeout / 1000 );
228+ else
229+ systemPrintf (" Next WiFi attempt in %d minutes.\r\n " , wifiConnectionAttemptTimeout / 1000 / 60 );
230+ }
231+ else
232+ {
233+ systemPrintln (" WiFi connection failed. Giving up." );
234+ // paintWiFiFail(4000, true); //TODO
235+ wifiStop (); // Move back to WIFI_OFF
236+ }
224237 }
225238 }
226239
@@ -244,6 +257,7 @@ void wifiUpdate()
244257 }
245258 break ;
246259 }
260+
247261#endif // COMPILE_WIFI
248262}
249263
You can’t perform that action at this time.
0 commit comments