Skip to content

Commit 666d1de

Browse files
committed
Prevent Web Config from stop network
1 parent 3f64f8f commit 666d1de

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Firmware/RTK_Everywhere/Network.ino

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,9 +1332,19 @@ void networkUpdate()
13321332
// If there are no consumers, but the network is online, shut down all networks
13331333
if (networkConsumers() == 0 && networkIsOnline() == true)
13341334
{
1335-
// Shutdown all networks
1336-
for (int index = 0; index < NETWORK_OFFLINE; index++)
1337-
networkStop(index, settings.debugNetworkLayer);
1335+
1336+
if (systemState == STATE_WIFI_CONFIG)
1337+
{
1338+
// The STATE_WIFI_CONFIG is in control of WiFi. Don't allow the network layer to shut it down
1339+
// As OTA exits, we need to keep AP running if we are in Web Config mode
1340+
// We don't want to make STATE_WIFI_CONFIG a consumer until startWebServer() uses the network layer
1341+
}
1342+
else
1343+
{
1344+
// Shutdown all networks
1345+
for (int index = 0; index < NETWORK_OFFLINE; index++)
1346+
networkStop(index, settings.debugNetworkLayer);
1347+
}
13381348
}
13391349

13401350
// Allow consumers to start networks
@@ -1528,7 +1538,7 @@ uint8_t networkConsumers()
15281538
consumerType |= (1 << 7);
15291539
}
15301540

1531-
// Network needed for to start a firmware update
1541+
// Network needed to start a firmware update
15321542
if (otaRequestFirmwareUpdate == true)
15331543
{
15341544
consumerCount++;

0 commit comments

Comments
 (0)