Skip to content

Commit 7cc094b

Browse files
authored
Merge pull request #684 from LeeLeahy2/wifi-stop
Add WIFI_STOP macro to display wifiStop caller when debugWiFiState=true
2 parents 2217b38 + 459966b commit 7cc094b

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace"
205205

206206
#ifdef COMPILE_WIFI
207207
#include "ESP32OTAPull.h" //http://librarymanager/All#ESP-OTA-Pull Used for getting
208+
209+
#define WIFI_STOP() \
210+
{ \
211+
if (settings.debugWifiState) \
212+
systemPrintf("wifiStop called by %s %d\r\n", __FILE__, __LINE__); \
213+
wifiStop(); \
214+
}
215+
208216
#endif // COMPILE_WIFI
209217

210218
#define OTA_FIRMWARE_JSON_URL \

Firmware/RTK_Surveyor/States.ino

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

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

123-
wifiStop(); // Stop WiFi, ntripClient will start as needed.
123+
WIFI_STOP(); // Stop WiFi, ntripClient will start as needed.
124124
bluetoothStart(); // Turn on Bluetooth with 'Rover' name
125125
radioStart(); // Start internal radio if enabled, otherwise disable
126126

@@ -249,7 +249,7 @@ void updateSystemState()
249249

250250
// Allow WiFi to continue running if NTRIP Client is needed for assisted survey in
251251
if (wifiIsNeeded() == false)
252-
wifiStop();
252+
WIFI_STOP();
253253

254254
bluetoothStop();
255255
bluetoothStart(); // Restart Bluetooth with 'Base' identifier

Firmware/RTK_Surveyor/WiFi.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void menuWiFi()
149149
if (wifiIsConnected())
150150
{
151151
log_d("Menu caused restarting of WiFi");
152-
wifiStop();
152+
WIFI_STOP();
153153
wifiStart();
154154
wifiConnectionAttempts = 0; // Reset the timeout
155155
}
@@ -222,7 +222,7 @@ bool wifiStartAP(bool forceAP)
222222
if (settings.wifiConfigOverAP == true || forceAP)
223223
{
224224
// Stop any current WiFi activity
225-
wifiStop();
225+
WIFI_STOP();
226226

227227
// Start in AP mode
228228
WiFi.mode(WIFI_AP);
@@ -347,7 +347,7 @@ void wifiUpdate()
347347
{
348348
systemPrintln("WiFi connection failed. Giving up.");
349349
displayNoWiFi(2000);
350-
wifiStop(); // Move back to WIFI_OFF
350+
WIFI_STOP(); // Move back to WIFI_OFF
351351
}
352352
}
353353
}
@@ -365,7 +365,7 @@ void wifiUpdate()
365365

366366
// If WiFi is connected, and no services require WiFi, shut it off
367367
else if (wifiIsNeeded() == false)
368-
wifiStop();
368+
WIFI_STOP();
369369

370370
break;
371371
}
@@ -387,7 +387,7 @@ void wifiStart()
387387
{
388388
systemPrintln("Error: Please enter at least one SSID before using WiFi");
389389
// paintNoWiFi(2000); //TODO
390-
wifiStop();
390+
WIFI_STOP();
391391
return;
392392
}
393393

@@ -441,7 +441,7 @@ void wifiShutdown()
441441
// esp_wifi_set_protocol requires WiFi to be started
442442
esp_err_t response = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR);
443443
if (response != ESP_OK)
444-
systemPrintf("wifiStop: Error setting ESP-Now lone protocol: %s\r\n", esp_err_to_name(response));
444+
systemPrintf("wifiShutdown: Error setting ESP-Now lone protocol: %s\r\n", esp_err_to_name(response));
445445
else
446446
log_d("WiFi disabled, ESP-Now left in place");
447447
}

Firmware/RTK_Surveyor/menuFirmware.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void menuFirmware()
120120
systemPrintln("Firmware update failed to connect to WiFi.");
121121

122122
if (previouslyConnected == false)
123-
wifiStop();
123+
WIFI_STOP();
124124

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

143143
if (previouslyConnected == false)
144-
wifiStop();
144+
WIFI_STOP();
145145
}
146146

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

316316
// Turn off any tasks so that we are not disrupted
317317
espnowStop();
318-
wifiStop();
318+
WIFI_STOP();
319319
bluetoothStop();
320320

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

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

557557
// If WiFi was originally off, turn it off again
558558
if (previouslyConnected == false)
559-
wifiStop();
559+
WIFI_STOP();
560560
}
561561

562562
if (gotVersion == true)
@@ -619,7 +619,7 @@ void otaUpdate()
619619

620620
// Update failed. If WiFi was originally off, turn it off again
621621
if (previouslyConnected == false)
622-
wifiStop();
622+
WIFI_STOP();
623623

624624
#endif // COMPILE_WIFI
625625
}

Firmware/RTK_Surveyor/menuPP.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ void menuPointPerfect()
11771177
}
11781178
}
11791179

1180-
wifiStop();
1180+
WIFI_STOP();
11811181
}
11821182
else if (incoming == 4)
11831183
{

0 commit comments

Comments
 (0)