Skip to content

Commit 00d3d64

Browse files
authored
Merge pull request #664 from LeeLeahy2/tcp-server
Update TCP server to better work as an NTRIP or base caster
2 parents 936db2f + 710f300 commit 00d3d64

File tree

8 files changed

+340
-224
lines changed

8 files changed

+340
-224
lines changed

Firmware/RTK_Everywhere/AP-Config/index.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,17 @@
16371637
<span class="icon-info-circle text-primary ms-2"></span>
16381638
</span>
16391639
</div>
1640+
<div id="tcpWiFiTypeDropdown" class="mt-3">
1641+
<label for="tcpOverWiFiStation">TCP Server Connection: </label>
1642+
<select name="tcpWiFiType" id="tcpOverWiFiStation" class="form-dropdown">
1643+
<option value="1">WiFi</option>
1644+
<option value="0">AP</option>
1645+
</select>
1646+
<span class="tt" data-bs-placement="right"
1647+
title="In WiFi mode, the device will attempt to connect to local WiFi to broadcast TCP packets. In AP mode, the device will become an Access Point that devices can connect to over WiFi.">
1648+
<span class="icon-info-circle text-primary ms-2"></span>
1649+
</span>
1650+
</div>
16401651
</div>
16411652
<div class="form-group row">
16421653
<p id="enableTcpServerError" class="inlineError"></p>
@@ -1677,18 +1688,6 @@
16771688
<div class="form-group row">
16781689
<p id="enableUdpServerError" class="inlineError"></p>
16791690
</div>
1680-
1681-
<div id="tcpUdpWiFiTypeDropdown" class="mt-3">
1682-
<label for="tcpUdpOverWiFiStation">TCP/UDP Server Connection: </label>
1683-
<select name="tcpUdpWiFiType" id="tcpUdpOverWiFiStation" class="form-dropdown">
1684-
<option value="1">WiFi</option>
1685-
<option value="0">AP</option>
1686-
</select>
1687-
<span class="tt" data-bs-placement="right"
1688-
title="In WiFi mode, the device will attempt to connect to local WiFi to broadcast TCP/UDP packets. In AP mode, the device will become an Access Point that devices can connect to over WiFi.">
1689-
<span class="icon-info-circle text-primary ms-2"></span>
1690-
</span>
1691-
</div>
16921691
</div>
16931692
</div>
16941693

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ bool webServerStart(int httpPort = 80)
171171
bool parseIncomingSettings() {return false;}
172172
void sendStringToWebsocket(const char* stringToSend) {}
173173
void stopWebServer() {}
174+
bool webServerSettingsCheckAndFree() {return false;}
175+
void webServerSettingsClone() {}
174176
void webServerStop() {}
175177
void webServerUpdate() {}
176178
void webServerVerifyTables() {}

Firmware/RTK_Everywhere/Network.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ void menuTcpUdp()
226226
if (settings.mdnsEnable)
227227
systemPrintf("n) MDNS host name: %s\r\n", settings.mdnsHostName);
228228

229-
systemPrint("a) Broadcast TCP/UDP Server packets over local WiFi or act as Access Point: ");
230-
systemPrintf("%s\r\n", settings.tcpUdpOverWiFiStation ? "WiFi" : "AP");
229+
systemPrint("t) Broadcast TCP/UDP Server packets over local WiFi or act as Access Point: ");
230+
systemPrintf("%s\r\n", settings.tcpOverWiFiStation ? "WiFi" : "AP");
231231

232232
systemPrint("u) Broadcast UDP Server packets over local WiFi or act as Access Point: ");
233233
systemPrintf("%s\r\n", settings.udpOverWiFiStation ? "WiFi" : "AP");
@@ -326,9 +326,9 @@ void menuTcpUdp()
326326
getUserInputString((char *)&settings.mdnsHostName, sizeof(settings.mdnsHostName));
327327
}
328328

329-
else if (incoming == 'a')
329+
else if (incoming == 't')
330330
{
331-
settings.tcpUdpOverWiFiStation ^= 1;
331+
settings.tcpOverWiFiStation ^= 1;
332332
wifiUpdateSettings();
333333
}
334334

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,6 @@ const TickType_t ringBuffer_longWait_ms = 300 / portTICK_PERIOD_MS;
343343
SemaphoreHandle_t ringBufferSemaphore = NULL;
344344
const char *ringBufferSemaphoreHolder = "None";
345345

346-
// tcpServer semaphore - prevent tcpServerClientSendData (handleGnssDataTask) and tcpServerUpdate
347-
// from gatecrashing each other. See #695 for why this is needed.
348-
SemaphoreHandle_t tcpServerSemaphore = NULL;
349-
const char *tcpServerSemaphoreHolder = "None";
350-
351346
// Display used/free space in menu and config page
352347
uint64_t sdCardSize;
353348
uint64_t sdFreeSpace;
@@ -444,6 +439,7 @@ bool otaRequestFirmwareUpdate = false;
444439

445440
bool enableRCFirmware; // Goes true from AP config page
446441
bool currentlyParsingData; // Goes true when we hit 750ms timeout with new data
442+
bool tcpServerInCasterMode;// True when TCP server is running in caster mode
447443

448444
// Give up connecting after this number of attempts
449445
// Connection attempts are throttled to increase the time between attempts

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ void processUart1Message(SEMP_PARSE_STATE *parse, uint16_t type)
754754
// If BaseCasterOverride is enabled, remove everything but RTCM from the circular buffer
755755
// to avoid saturating the downstream radio link that is consuming over a TCP (NTRIP Caster) connection
756756
// Remove NMEA, etc after passing to the GNSS receiver library so that we still have SIV and other stats available
757-
if (settings.baseCasterOverride == true)
757+
if (tcpServerInCasterMode)
758758
{
759759
if (type != RTK_RTCM_PARSER_INDEX)
760760
{

0 commit comments

Comments
 (0)