Skip to content

Commit bd8b15f

Browse files
committed
WiFi: Always stop WiFi station in WIFI_STATION_STATE_WAIT_NO_USERS
1 parent d62ed2b commit bd8b15f

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

Firmware/RTK_Everywhere/WiFi.ino

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,28 +1047,23 @@ void wifiStationUpdate()
10471047
// No more network users
10481048
else
10491049
{
1050-
// Stop WiFi station if necessary
1051-
if (enabled == false)
1050+
// Display the major state transition
1051+
if (wifiStationRunning)
10521052
{
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+
}
10611058

1059+
// Stop WiFi station if necessary
1060+
if (enabled == false)
10621061
// Reset the start timeout
10631062
wifiStationSetState(WIFI_STATION_STATE_OFF);
1064-
}
10651063

10661064
// Restart WiFi after delay
10671065
else
10681066
{
1069-
// Clear the bits to perform the restart operation
1070-
wifi.clearStarted(WIFI_STA_RECONNECT);
1071-
10721067
// Display the restart delay and then start WiFi station
10731068
if (startTimeout && settings.debugWifiState)
10741069
{
@@ -1174,6 +1169,7 @@ void wifiStationUpdate()
11741169
// Wait until the WiFi link is stable
11751170
if ((millis() - timer) >= WIFI_CONNECTION_STABLE_MSEC)
11761171
{
1172+
// Reset restart timeout and the connection attempts
11771173
connectionAttempts = 0;
11781174
startTimeout = 0;
11791175
wifiStationSetState(WIFI_STATION_STATE_STABLE);

0 commit comments

Comments
 (0)