@@ -1047,28 +1047,23 @@ void wifiStationUpdate()
1047
1047
// No more network users
1048
1048
else
1049
1049
{
1050
- // Stop WiFi station if necessary
1051
- if (enabled == false )
1050
+ // Display the major state transition
1051
+ if (wifiStationRunning )
1052
1052
{
1053
- // Display the major state transition
1054
- if (wifiStationRunning)
1055
- {
1056
- if (settings.debugWifiState )
1057
- systemPrintf (" --------------- %s Stopping ---------------\r\n " ,
1058
- networkInterfaceTable[NETWORK_WIFI_STATION].name );
1059
- wifiStationOff (__FILE__, __LINE__);
1060
- }
1053
+ if (settings.debugWifiState )
1054
+ systemPrintf (" --------------- %s Stopping ---------------\r\n " ,
1055
+ networkInterfaceTable[NETWORK_WIFI_STATION].name );
1056
+ wifiStationOff (__FILE__, __LINE__);
1057
+ }
1061
1058
1059
+ // Stop WiFi station if necessary
1060
+ if (enabled == false )
1062
1061
// Reset the start timeout
1063
1062
wifiStationSetState (WIFI_STATION_STATE_OFF);
1064
- }
1065
1063
1066
1064
// Restart WiFi after delay
1067
1065
else
1068
1066
{
1069
- // Clear the bits to perform the restart operation
1070
- wifi.clearStarted (WIFI_STA_RECONNECT);
1071
-
1072
1067
// Display the restart delay and then start WiFi station
1073
1068
if (startTimeout && settings.debugWifiState )
1074
1069
{
@@ -1174,6 +1169,7 @@ void wifiStationUpdate()
1174
1169
// Wait until the WiFi link is stable
1175
1170
if ((millis () - timer) >= WIFI_CONNECTION_STABLE_MSEC)
1176
1171
{
1172
+ // Reset restart timeout and the connection attempts
1177
1173
connectionAttempts = 0 ;
1178
1174
startTimeout = 0 ;
1179
1175
wifiStationSetState (WIFI_STATION_STATE_STABLE);
0 commit comments