Skip to content

Commit d62ed2b

Browse files
committed
WiFi: Move WIFI_STATION_STATE_OFF state
1 parent f2fface commit d62ed2b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

Firmware/RTK_Everywhere/WiFi.ino

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,19 +1025,6 @@ void wifiStationUpdate()
10251025
// Update the WiFi station state
10261026
switch (wifiStationState)
10271027
{
1028-
// There are no WiFi station consumers
1029-
case WIFI_STATION_STATE_OFF:
1030-
if (enabled)
1031-
{
1032-
connectionAttempts = 0;
1033-
timer = millis();
1034-
startTimeout = 0;
1035-
1036-
// Start WiFi station
1037-
wifiStationSetState(WIFI_STATION_STATE_RESTART_DELAY);
1038-
}
1039-
break;
1040-
10411028
// Wait for WiFi station users to release resources before shutting
10421029
// down WiFi station
10431030
case WIFI_STATION_STATE_WAIT_NO_USERS:
@@ -1097,6 +1084,27 @@ void wifiStationUpdate()
10971084
}
10981085
break;
10991086

1087+
// There are no WiFi station consumers
1088+
case WIFI_STATION_STATE_OFF:
1089+
// Check for disabled
1090+
if (!enabled)
1091+
break;
1092+
1093+
// Reset the restart timeout when off
1094+
if (wifiStationState == WIFI_STATION_STATE_OFF)
1095+
{
1096+
connectionAttempts = 0;
1097+
timer = millis();
1098+
startTimeout = 0;
1099+
}
1100+
1101+
// Wait for the delay to complete
1102+
wifiStationSetState(WIFI_STATION_STATE_RESTART_DELAY);
1103+
1104+
// |
1105+
// | Fall through
1106+
// V
1107+
11001108
// Perform the restart delay
11011109
case WIFI_STATION_STATE_RESTART_DELAY:
11021110
// Stop WiFi station if necessary

0 commit comments

Comments
 (0)