Skip to content

Commit 811e9f2

Browse files
committed
Don't restart WiFi if there are consumers and connectivity
1 parent 8d74ba6 commit 811e9f2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Firmware/RTK_Everywhere/WiFi.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,13 @@ void wifiUpdateSettings()
11311131
// Remember the change in SSID values
11321132
wifiStationSsidSet = ssidSet;
11331133

1134-
//If WiFi currently has connectivity, don't restart it
1135-
if(networkHasInternet() == false)
1134+
//If there are consumers, and WiFi currently has connectivity, don't restart it
1135+
if((networkConsumerCount(NETWORK_WIFI_STATION) > 0) && (networkHasInternet() == false))
1136+
{
1137+
if (settings.debugWifiState)
1138+
systemPrintln("Restarting WiFi because settings have changed");
11361139
wifiStationRestart = ssidSet;
1140+
}
11371141

11381142
// Determine if the WiFi soft AP SSID string is present
11391143
wifiSoftApSsidSet = (wifiSoftApSsid && strlen(wifiSoftApSsid));
@@ -1343,9 +1347,6 @@ bool RTK_WIFI::enable(bool enableESPNow,
13431347
// Update the station state
13441348
if (enableStation)
13451349
{
1346-
//Load the latest settings
1347-
wifiUpdateSettings();
1348-
13491350
// Verify that at least one SSID is set
13501351
if (wifiStationSsidSet == false)
13511352
{

0 commit comments

Comments
 (0)