Skip to content

Commit 78bbfc1

Browse files
committed
Rename start/stopWebServer. Add stopWebServer.
1 parent 676c1e9 commit 78bbfc1

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

Firmware/RTK_Surveyor/Form.ino

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
//After user clicks 'save', data is validated via main.js and a long string of values is returned.
33

44
//Start webserver in AP mode
5-
void startConfigAP()
5+
void startWebServer()
66
{
7-
stopBluetooth();
8-
stopUART2Tasks(); //Delete F9 serial tasks if running
9-
107
#ifdef COMPILE_WIFI
118
#ifdef COMPILE_AP
129

@@ -37,6 +34,7 @@ void startConfigAP()
3734
//#define LOCAL_WIFI_TESTING 1
3835

3936
#ifndef LOCAL_WIFI_TESTING
37+
4038
//Start in AP mode
4139
WiFi.mode(WIFI_AP);
4240

@@ -173,12 +171,31 @@ void startConfigAP()
173171
}, handleFirmwareFileUpload);
174172

175173
server.begin();
174+
175+
log_d("Web Server Started");
176+
reportHeapNow();
177+
176178
#endif
177179
#endif
178180

179181
wifiState = WIFI_NOTCONNECTED;
180182
}
181183

184+
void stopWebServer()
185+
{
186+
#ifdef COMPILE_WIFI
187+
#ifdef COMPILE_AP
188+
189+
//server.reset();
190+
server.end();
191+
192+
log_d("Web Server Stopped");
193+
reportHeapNow();
194+
195+
#endif
196+
#endif
197+
}
198+
182199
//Handler for firmware file upload
183200
#ifdef COMPILE_WIFI
184201
#ifdef COMPILE_AP

Firmware/RTK_Surveyor/States.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void updateSystemState()
139139

140140
i2cGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_UART2, 0); //Disable RTCM sentences
141141

142+
stopWebServer();
142143
stopWiFi(); //Turn off WiFi and release all resources
143144
startBluetooth(); //Turn on Bluetooth with 'Rover' name
144145
startUART2Tasks(); //Start monitoring the UART1 from ZED for NMEA and UBX data (enables logging)
@@ -152,7 +153,7 @@ void updateSystemState()
152153
if (settings.enableNtripClient == true && ntripClientAttempted == false)
153154
{
154155
//Turn off Bluetooth and turn on WiFi
155-
//stopBluetooth();
156+
stopBluetooth();
156157
startWiFi(settings.ntripClient_wifiSSID, settings.ntripClient_wifiPW);
157158
wifiStartTime = millis();
158159

@@ -489,6 +490,7 @@ void updateSystemState()
489490
displayBaseStart(0); //Show 'Base'
490491

491492
//Stop all WiFi and BT. Re-enable in each specific base start state.
493+
stopWebServer();
492494
stopWiFi();
493495
stopBluetooth();
494496
startUART2Tasks(); //Start monitoring the UART1 from ZED for NMEA and UBX data (enables logging)
@@ -1051,8 +1053,9 @@ void updateSystemState()
10511053

10521054
displayWiFiConfigNotStarted(); //Display immediately during SD cluster pause
10531055

1054-
//Start in AP mode and show config html page
1055-
startConfigAP();
1056+
stopBluetooth();
1057+
stopUART2Tasks(); //Delete F9 serial tasks if running
1058+
startWebServer(); //Start in AP mode and show config html page
10561059

10571060
changeState(STATE_WIFI_CONFIG);
10581061
}

Firmware/RTK_Surveyor/menuFirmware.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void scanForFirmware()
102102
void updateFromSD(const char *firmwareFileName)
103103
{
104104
//Turn off any tasks so that we are not disrupted
105+
stopWebServer();
105106
stopWiFi();
106107
stopBluetooth();
107108

0 commit comments

Comments
 (0)