Skip to content

Commit 4d83441

Browse files
committed
Add NETWORK_STOP macro to print location of call to networkStop
1 parent 44b78b5 commit 4d83441

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

Firmware/RTK_Surveyor/Network.ino

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,9 @@ void networkTypeUpdate(uint8_t networkType)
10411041
case NETWORK_STATE_DELAY:
10421042
// Determine if the network is shutting down
10431043
if (network->shutdown)
1044-
networkStop(network->type);
1044+
{
1045+
NETWORK_STOP(network->type);
1046+
}
10451047

10461048
// Delay before starting the network
10471049
else if ((millis() - network->timerStart) >= network->timeout)
@@ -1070,7 +1072,9 @@ void networkTypeUpdate(uint8_t networkType)
10701072
case NETWORK_STATE_CONNECTING:
10711073
// Determine if the network is shutting down
10721074
if (network->shutdown)
1073-
networkStop(network->type);
1075+
{
1076+
NETWORK_STOP(network->type);
1077+
}
10741078

10751079
// Determine if the connection failed
10761080
else if ((millis() - network->timerStart) >= network->timeout)
@@ -1079,7 +1083,7 @@ void networkTypeUpdate(uint8_t networkType)
10791083
if (settings.debugNetworkLayer)
10801084
systemPrintf("Network: %s connection timed out\r\n", networkName[network->type]);
10811085
networkRestartNetwork(network);
1082-
networkStop(network->type);
1086+
NETWORK_STOP(network->type);
10831087
}
10841088

10851089
// Determine if the RTK host is connected to the network
@@ -1099,7 +1103,9 @@ void networkTypeUpdate(uint8_t networkType)
10991103
case NETWORK_STATE_IN_USE:
11001104
// Determine if the network is shutting down
11011105
if (network->shutdown)
1102-
networkStop(network->type);
1106+
{
1107+
NETWORK_STOP(network->type);
1108+
}
11031109

11041110
// Verify that the RTK device is still connected to the network
11051111
else if (!networkIsMediaConnected(network))
@@ -1108,7 +1114,7 @@ void networkTypeUpdate(uint8_t networkType)
11081114
if (settings.debugNetworkLayer)
11091115
systemPrintf("Network: %s connection failed!\r\n", networkName[network->type]);
11101116
networkRestartNetwork(network);
1111-
networkStop(network->type);
1117+
NETWORK_STOP(network->type);
11121118
}
11131119

11141120
// Check for the idle timeout
@@ -1130,15 +1136,15 @@ void networkTypeUpdate(uint8_t networkType)
11301136
{
11311137
if (settings.debugNetworkLayer)
11321138
systemPrintf("Network shutting down %s, no users\r\n", networkName[network->type]);
1133-
networkStop(network->type);
1139+
NETWORK_STOP(network->type);
11341140
}
11351141
}
11361142
break;
11371143

11381144
case NETWORK_STATE_WAIT_NO_USERS:
11391145
// Stop the network when all the users are removed
11401146
if (!network->activeUsers)
1141-
networkStop(network->type);
1147+
NETWORK_STOP(network->type);
11421148
break;
11431149
}
11441150

@@ -1208,7 +1214,7 @@ void networkUserClose(uint8_t user)
12081214

12091215
// Shutdown the network if requested
12101216
if (network->shutdown && (!network->activeUsers))
1211-
networkStop(network->type);
1217+
NETWORK_STOP(network->type);
12121218
}
12131219

12141220
// The network user is not running

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace"
208208

209209
#include "esp_ota_ops.h" //Needed for partition counting and updateFromSD
210210

211+
#define NETWORK_STOP(type) \
212+
{ \
213+
if (settings.debugNetworkLayer) \
214+
systemPrintf("networkStop called by %s %d\r\n", __FILE__, __LINE__); \
215+
networkStop(type); \
216+
}
217+
211218
#ifdef COMPILE_WIFI
212219
#include "ESP32OTAPull.h" //http://librarymanager/All#ESP-OTA-Pull Used for getting
213220

Firmware/RTK_Surveyor/States.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void updateSystemState()
121121

122122
setMuxport(settings.dataPortChannel); // Return mux to original channel
123123

124-
networkStop(NETWORK_TYPE_WIFI);
124+
NETWORK_STOP(NETWORK_TYPE_WIFI);
125125
WIFI_STOP(); // Stop WiFi, ntripClient will start as needed.
126126
bluetoothStart(); // Turn on Bluetooth with 'Rover' name
127127
radioStart(); // Start internal radio if enabled, otherwise disable
@@ -254,7 +254,7 @@ void updateSystemState()
254254
// Allow WiFi to continue running if NTRIP Client is needed for assisted survey in
255255
if (wifiIsNeeded() == false)
256256
{
257-
networkStop(NETWORK_TYPE_WIFI);
257+
NETWORK_STOP(NETWORK_TYPE_WIFI);
258258
WIFI_STOP();
259259
}
260260

Firmware/RTK_Surveyor/WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void wifiStop()
426426
dnsServer.stop();
427427

428428
// Stop the other network clients and then WiFi
429-
networkStop(NETWORK_TYPE_WIFI);
429+
NETWORK_STOP(NETWORK_TYPE_WIFI);
430430
}
431431

432432
// Stop WiFi and release all resources

0 commit comments

Comments
 (0)