Skip to content

Commit 0439344

Browse files
committed
Use networkStart/Stop functions
1 parent b88919e commit 0439344

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

Firmware/RTK_Everywhere/Network.ino

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,31 +1333,19 @@ void networkUpdate()
13331333
{
13341334
// Shutdown all networks
13351335
for (int index = 0; index < NETWORK_OFFLINE; index++)
1336-
{
1337-
NetMask_t bitMask = 1 << index;
1338-
if (networkInterfaceTable[index].stop && (networkStarted & bitMask))
1339-
{
1340-
// Stop this network
1341-
systemPrintf("Stopping %s\r\n", networkGetNameByIndex(index));
1342-
networkSequenceStop(index, settings.debugNetworkLayer);
1343-
}
1344-
}
1336+
networkStop(index, settings.debugNetworkLayer);
13451337
}
13461338

1347-
// Allow consumers to start networks
1339+
// Allow consumers to re-start networks
13481340
if (networkConsumers() > 0 && networkIsOnline() == false)
13491341
{
1350-
// Start network as needed. Skip Ethernet as its always on.
1351-
for (int index = NETWORK_WIFI; index < NETWORK_OFFLINE; index++)
1352-
{
1353-
NetMask_t bitMask = 1 << index;
1354-
if (networkInterfaceTable[index].stop && networkIsPresent(index))
1355-
{
1356-
// Start this network
1357-
systemPrintf("Starting %s\r\n", networkGetNameByIndex(index));
1358-
networkSequenceStart(index, settings.debugNetworkLayer);
1359-
}
1360-
}
1342+
// Stop any running networks
1343+
for (int index = 0; index < NETWORK_OFFLINE; index++)
1344+
networkStop(index, settings.debugNetworkLayer);
1345+
1346+
// Start network as needed
1347+
for (int index = 0; index < NETWORK_OFFLINE; index++)
1348+
networkStart(index, settings.debugNetworkLayer);
13611349
}
13621350

13631351
// Walk the list of network priorities in descending order

0 commit comments

Comments
 (0)