Skip to content

Add WIFI_STOP macro to display wifiStop caller when debugWiFiState=true #684

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
Sep 28, 2023
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
8 changes: 8 additions & 0 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace"

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

#define WIFI_STOP() \
{ \
if (settings.debugWifiState) \
systemPrintf("wifiStop called by %s %d\r\n", __FILE__, __LINE__); \
wifiStop(); \
}

#endif // COMPILE_WIFI

#define OTA_FIRMWARE_JSON_URL \
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 @@ -120,7 +120,7 @@ void updateSystemState()

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

wifiStop(); // Stop WiFi, ntripClient will start as needed.
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 @@ -249,7 +249,7 @@ void updateSystemState()

// Allow WiFi to continue running if NTRIP Client is needed for assisted survey in
if (wifiIsNeeded() == false)
wifiStop();
WIFI_STOP();

bluetoothStop();
bluetoothStart(); // Restart Bluetooth with 'Base' identifier
Expand Down
12 changes: 6 additions & 6 deletions Firmware/RTK_Surveyor/WiFi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void menuWiFi()
if (wifiIsConnected())
{
log_d("Menu caused restarting of WiFi");
wifiStop();
WIFI_STOP();
wifiStart();
wifiConnectionAttempts = 0; // Reset the timeout
}
Expand Down Expand Up @@ -222,7 +222,7 @@ bool wifiStartAP(bool forceAP)
if (settings.wifiConfigOverAP == true || forceAP)
{
// Stop any current WiFi activity
wifiStop();
WIFI_STOP();

// Start in AP mode
WiFi.mode(WIFI_AP);
Expand Down Expand Up @@ -347,7 +347,7 @@ void wifiUpdate()
{
systemPrintln("WiFi connection failed. Giving up.");
displayNoWiFi(2000);
wifiStop(); // Move back to WIFI_OFF
WIFI_STOP(); // Move back to WIFI_OFF
}
}
}
Expand All @@ -365,7 +365,7 @@ void wifiUpdate()

// If WiFi is connected, and no services require WiFi, shut it off
else if (wifiIsNeeded() == false)
wifiStop();
WIFI_STOP();

break;
}
Expand All @@ -387,7 +387,7 @@ void wifiStart()
{
systemPrintln("Error: Please enter at least one SSID before using WiFi");
// paintNoWiFi(2000); //TODO
wifiStop();
WIFI_STOP();
return;
}

Expand Down Expand Up @@ -441,7 +441,7 @@ void wifiShutdown()
// esp_wifi_set_protocol requires WiFi to be started
esp_err_t response = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR);
if (response != ESP_OK)
systemPrintf("wifiStop: Error setting ESP-Now lone protocol: %s\r\n", esp_err_to_name(response));
systemPrintf("wifiShutdown: Error setting ESP-Now lone protocol: %s\r\n", esp_err_to_name(response));
else
log_d("WiFi disabled, ESP-Now left in place");
}
Expand Down
12 changes: 6 additions & 6 deletions Firmware/RTK_Surveyor/menuFirmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void menuFirmware()
systemPrintln("Firmware update failed to connect to WiFi.");

if (previouslyConnected == false)
wifiStop();
WIFI_STOP();

if(bluetoothOriginallyConnected == true)
bluetoothStart(); // Restart BT according to settings
Expand All @@ -141,7 +141,7 @@ void menuFirmware()
// We get here if WiFi failed or the server was not available

if (previouslyConnected == false)
wifiStop();
WIFI_STOP();
}

else if (incoming == 'e')
Expand Down Expand Up @@ -315,7 +315,7 @@ void updateFromSD(const char *firmwareFileName)

// Turn off any tasks so that we are not disrupted
espnowStop();
wifiStop();
WIFI_STOP();
bluetoothStop();

// Delete tasks if running
Expand Down Expand Up @@ -551,12 +551,12 @@ bool otaCheckVersion(char *versionAvailable, uint8_t versionAvailableLength)

if (systemState != STATE_WIFI_CONFIG)
{
// wifiStop() turns off the entire radio including the webserver. We need to turn off Station mode only.
// WIFI_STOP() turns off the entire radio including the webserver. We need to turn off Station mode only.
// For now, unit exits AP mode via reset so if we are in AP config mode, leave WiFi Station running.

// If WiFi was originally off, turn it off again
if (previouslyConnected == false)
wifiStop();
WIFI_STOP();
}

if (gotVersion == true)
Expand Down Expand Up @@ -619,7 +619,7 @@ void otaUpdate()

// Update failed. If WiFi was originally off, turn it off again
if (previouslyConnected == false)
wifiStop();
WIFI_STOP();

#endif // COMPILE_WIFI
}
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/menuPP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ void menuPointPerfect()
}
}

wifiStop();
WIFI_STOP();
}
else if (incoming == 4)
{
Expand Down