File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
examples/NonBlockingCaptivePortal Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ void setup() {
59
59
});
60
60
61
61
espConnect.setConnectTimeout (20 ); // 20 seconds
62
- espConnect.setCaptivePortalTimeout (30 ); // 30 seconds
63
- espConnect.setAutoRestart (false );
62
+ espConnect.setCaptivePortalTimeout (40 ); // 30 seconds
63
+ espConnect.setAutoRestart (true );
64
64
espConnect.setBlocking (false );
65
65
66
66
Serial.println (" ====> Trying to connect to saved WiFi or will start portal in the background..." );
Original file line number Diff line number Diff line change @@ -402,12 +402,12 @@ void Mycila::ESPConnect::loop() {
402
402
403
403
if (_state == Mycila::ESPConnect::State::PORTAL_TIMEOUT) {
404
404
LOGW (TAG, " Portal timeout!" );
405
- _stopAP ();
406
405
if (_autoRestart) {
407
406
LOGW (TAG, " Restarting ESP..." );
408
407
ESP.restart ();
409
408
} else {
410
409
// try to reconnect again with configured settings
410
+ _stopAP ();
411
411
_setState (Mycila::ESPConnect::State::NETWORK_ENABLED);
412
412
}
413
413
}
@@ -420,7 +420,6 @@ void Mycila::ESPConnect::loop() {
420
420
} else if (millis () - _restartRequestTime >= _restartDelay) {
421
421
// delay is over restart
422
422
LOGW (TAG, " Auto Restart of ESP..." );
423
- _stopAP ();
424
423
ESP.restart ();
425
424
}
426
425
} else {
You can’t perform that action at this time.
0 commit comments