Skip to content

Commit 86ddf45

Browse files
committed
WiFi: Move WIFI_STATION_STATE_OFF state
1 parent 3c31dc0 commit 86ddf45

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
@@ -979,19 +979,6 @@ void wifiStationUpdate()
979979
// Update the WiFi station state
980980
switch (wifiStationState)
981981
{
982-
// There are no WiFi station consumers
983-
case WIFI_STATION_STATE_OFF:
984-
if (enabled)
985-
{
986-
connectionAttempts = 0;
987-
timer = millis();
988-
startTimeout = 0;
989-
990-
// Start WiFi station
991-
wifiStationSetState(WIFI_STATION_STATE_RESTART_DELAY);
992-
}
993-
break;
994-
995982
// Wait for WiFi station users to release resources before shutting
996983
// down WiFi station
997984
case WIFI_STATION_STATE_WAIT_NO_USERS:
@@ -1051,6 +1038,27 @@ void wifiStationUpdate()
10511038
}
10521039
break;
10531040

1041+
// There are no WiFi station consumers
1042+
case WIFI_STATION_STATE_OFF:
1043+
// Check for disabled
1044+
if (!enabled)
1045+
break;
1046+
1047+
// Reset the restart timeout when off
1048+
if (wifiStationState == WIFI_STATION_STATE_OFF)
1049+
{
1050+
connectionAttempts = 0;
1051+
timer = millis();
1052+
startTimeout = 0;
1053+
}
1054+
1055+
// Wait for the delay to complete
1056+
wifiStationSetState(WIFI_STATION_STATE_RESTART_DELAY);
1057+
1058+
// |
1059+
// | Fall through
1060+
// V
1061+
10541062
// Perform the restart delay
10551063
case WIFI_STATION_STATE_RESTART_DELAY:
10561064
// Stop WiFi station if necessary

0 commit comments

Comments
 (0)