Skip to content

Commit e8ab0bb

Browse files
committed
Prevent WiFi from starting if there are no consumers
1 parent 94bbd4a commit e8ab0bb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Firmware/RTK_Everywhere/WiFi.ino

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,14 +776,21 @@ bool wifiStationEnabled(const char ** reason)
776776

777777
do
778778
{
779+
// Verify that there is at least one consumer
780+
if(networkConsumerCount(NETWORK_WIFI_STATION) == 0)
781+
{
782+
*reason = ", No consumers";
783+
break;
784+
}
785+
779786
// Verify that at least one SSID value is set
780787
if (wifiStationSsidSet == false)
781788
{
782789
*reason = ", SSID not available";
783790
break;
784791
}
785792

786-
// Determine if Wifi is begin restarted
793+
// Determine if WiFi is begin restarted
787794
if (wifiStationRestart)
788795
{
789796
wifiStationRestart = false;
@@ -3084,10 +3091,10 @@ bool RTK_WIFI::stopStart(WIFI_ACTION_t stopping, WIFI_ACTION_t starting)
30843091
systemPrintf("WiFi: RTK_WIFI::stopStart returning; %s\r\n", enabled ? "true" : "false");
30853092
if(enabled == false)
30863093
{
3087-
systemPrintf("0x%08x: _started\r\n", _started);
3088-
systemPrintf("0x%08x: allOnline\r\n", allOnline);
3089-
systemPrintf("0x%08x: (_started & allOnline)\r\n", (_started & allOnline));
3090-
systemPrintf("0x%08x: expected\r\n", expected);
3094+
systemPrintf(" 0x%08x: _started\r\n", _started);
3095+
systemPrintf(" 0x%08x: allOnline\r\n", allOnline);
3096+
systemPrintf(" 0x%08x: (_started & allOnline)\r\n", (_started & allOnline));
3097+
systemPrintf(" 0x%08x: expected\r\n", expected);
30913098
}
30923099

30933100
reportHeapNow(true);

0 commit comments

Comments
 (0)