@@ -106,7 +106,6 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {
106
106
if (_sta_network_if == NULL || ev->event_id < ARDUINO_EVENT_WIFI_STA_START || ev->event_id > ARDUINO_EVENT_WIFI_STA_LOST_IP) {
107
107
return ;
108
108
}
109
- static bool first_connect = true ;
110
109
log_v (" Arduino STA Event: %d - %s" , ev->event_id , Network.eventName (ev->event_id ));
111
110
112
111
if (ev->event_id == ARDUINO_EVENT_WIFI_STA_START) {
@@ -137,7 +136,7 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {
137
136
log_w (" Reason: %u - %s" , reason, WiFi.STA .disconnectReasonName ((wifi_err_reason_t )reason));
138
137
if (reason == WIFI_REASON_NO_AP_FOUND) {
139
138
_sta_network_if->_setStatus (WL_NO_SSID_AVAIL);
140
- } else if ((reason == WIFI_REASON_AUTH_FAIL) && !first_connect ) {
139
+ } else if ((reason == WIFI_REASON_AUTH_FAIL)) {
141
140
_sta_network_if->_setStatus (WL_CONNECT_FAILED);
142
141
} else if (reason == WIFI_REASON_BEACON_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
143
142
_sta_network_if->_setStatus (WL_CONNECTION_LOST);
@@ -149,10 +148,6 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {
149
148
150
149
bool DoReconnect = false ;
151
150
if (reason == WIFI_REASON_ASSOC_LEAVE) { // Voluntarily disconnected. Don't reconnect!
152
- } else if (first_connect) { // Retry once for all failure reasons
153
- first_connect = false ;
154
- DoReconnect = true ;
155
- log_d (" WiFi Reconnect Running" );
156
151
} else if (_sta_network_if->getAutoReconnect () && _is_staReconnectableReason (reason)) {
157
152
DoReconnect = true ;
158
153
log_d (" WiFi AutoReconnect Running" );
0 commit comments