Skip to content

Add NETWORK_STOP macro to print location of call to networkStop #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Firmware/RTK_Surveyor/Network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,9 @@ void networkTypeUpdate(uint8_t networkType)
case NETWORK_STATE_DELAY:
// Determine if the network is shutting down
if (network->shutdown)
networkStop(network->type);
{
NETWORK_STOP(network->type);
}

// Delay before starting the network
else if ((millis() - network->timerStart) >= network->timeout)
Expand Down Expand Up @@ -1070,7 +1072,9 @@ void networkTypeUpdate(uint8_t networkType)
case NETWORK_STATE_CONNECTING:
// Determine if the network is shutting down
if (network->shutdown)
networkStop(network->type);
{
NETWORK_STOP(network->type);
}

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

// Determine if the RTK host is connected to the network
Expand All @@ -1099,7 +1103,9 @@ void networkTypeUpdate(uint8_t networkType)
case NETWORK_STATE_IN_USE:
// Determine if the network is shutting down
if (network->shutdown)
networkStop(network->type);
{
NETWORK_STOP(network->type);
}

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

// Check for the idle timeout
Expand All @@ -1130,15 +1136,15 @@ void networkTypeUpdate(uint8_t networkType)
{
if (settings.debugNetworkLayer)
systemPrintf("Network shutting down %s, no users\r\n", networkName[network->type]);
networkStop(network->type);
NETWORK_STOP(network->type);
}
}
break;

case NETWORK_STATE_WAIT_NO_USERS:
// Stop the network when all the users are removed
if (!network->activeUsers)
networkStop(network->type);
NETWORK_STOP(network->type);
break;
}

Expand Down Expand Up @@ -1208,7 +1214,7 @@ void networkUserClose(uint8_t user)

// Shutdown the network if requested
if (network->shutdown && (!network->activeUsers))
networkStop(network->type);
NETWORK_STOP(network->type);
}

// The network user is not running
Expand Down
7 changes: 7 additions & 0 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace"

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

#define NETWORK_STOP(type) \
{ \
if (settings.debugNetworkLayer) \
systemPrintf("networkStop called by %s %d\r\n", __FILE__, __LINE__); \
networkStop(type); \
}

#ifdef COMPILE_WIFI
#include "ESP32OTAPull.h" //http://librarymanager/All#ESP-OTA-Pull Used for getting

Expand Down
4 changes: 2 additions & 2 deletions Firmware/RTK_Surveyor/States.ino
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void updateSystemState()

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

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

Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/WiFi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void wifiStop()
dnsServer.stop();

// Stop the other network clients and then WiFi
networkStop(NETWORK_TYPE_WIFI);
NETWORK_STOP(NETWORK_TYPE_WIFI);
}

// Stop WiFi and release all resources
Expand Down