Skip to content

Commit 16c351d

Browse files
committed
Switch to using ntripServerArray
1 parent 1370e9b commit 16c351d

File tree

7 files changed

+107
-77
lines changed

7 files changed

+107
-77
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ void DevUBLOXGNSS::processRTCM(uint8_t incoming)
349349
rtcmLastReceived = millis();
350350
rtcmBytesSent++;
351351

352-
ntripServerProcessRTCM(incoming);
352+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
353+
ntripServerProcessRTCM(serverIndex, incoming);
353354

354355
espnowProcessRTCM(incoming);
355356
}
@@ -391,7 +392,8 @@ void processRTCMBuffer()
391392
rtcmLastReceived = millis();
392393
rtcmBytesSent++;
393394

394-
ntripServerProcessRTCM(incoming);
395+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
396+
ntripServerProcessRTCM(serverIndex, incoming);
395397

396398
espnowProcessRTCM(incoming);
397399
}

Firmware/RTK_Surveyor/Developer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void ntripClientValidateTables() {}
5959
// NTRIP server
6060
//----------------------------------------
6161

62-
bool ntripServerIsCasting() {return false;}
63-
void ntripServerPrintStatus() {systemPrint("NTRIP Server not compiled");}
64-
void ntripServerProcessRTCM(uint8_t incoming) {}
65-
void ntripServerStop(bool clientAllocated) {online.ntripServer = false;}
62+
bool ntripServerIsCasting(int serverIndex) {return false;}
63+
void ntripServerPrintStatus(int serverIndex) {systemPrintf("**NTRIP Server %d not compiled**\r\n", serverIndex);}
64+
void ntripServerProcessRTCM(int serverIndex, uint8_t incoming) {}
65+
void ntripServerStop(int serverIndex, bool clientAllocated) {online.ntripServer = false;}
6666
void ntripServerUpdate() {}
6767
void ntripServerValidateTables() {}
6868

Firmware/RTK_Surveyor/Form.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ bool startWebServer(bool startWiFi = true, int httpPort = 80)
6060
do
6161
{
6262
ntripClientStop(true); // Do not allocate new wifiClient
63-
ntripServerStop(true); // Do not allocate new wifiClient
63+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
64+
ntripServerStop(serverIndex, true); // Do not allocate new wifiClient
6465

6566
if (startWiFi)
6667
if (wifiStartAP() == false) // Exits calling wifiConnect()

Firmware/RTK_Surveyor/Network.ino

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ const char * const networkUser[] =
183183
{
184184
"NTP Server",
185185
"NTRIP Client",
186-
"NTRIP Server",
187186
"OTA Firmware Update",
188187
"PVT Client",
189188
"PVT Server",
190189
"PVT UDP Server",
190+
"NTRIP Server 0",
191191
};
192192
const int networkUserEntries = sizeof(networkUser) / sizeof(networkUser[0]);
193193

@@ -838,6 +838,7 @@ void networkStop(uint8_t networkType)
838838
{
839839
NETWORK_DATA * network;
840840
bool restart;
841+
int serverIndex;
841842
bool shutdown;
842843
int user;
843844

@@ -877,6 +878,17 @@ void networkStop(uint8_t networkType)
877878
// Stop the network client
878879
switch(user)
879880
{
881+
default:
882+
if ((user >= NETWORK_USER_NTRIP_SERVER)
883+
&& (user < (NETWORK_USER_NTRIP_SERVER + NTRIP_SERVER_MAX)))
884+
{
885+
serverIndex = user - NETWORK_USER_NTRIP_SERVER;
886+
if (settings.debugNetworkLayer)
887+
systemPrintln("Network layer stopping NTRIP server");
888+
ntripServerRestart(serverIndex);
889+
}
890+
break;
891+
880892
case NETWORK_USER_NTP_SERVER:
881893
if (settings.debugNetworkLayer)
882894
systemPrintln("Network layer stopping NTP server");
@@ -889,12 +901,6 @@ void networkStop(uint8_t networkType)
889901
ntripClientRestart();
890902
break;
891903

892-
case NETWORK_USER_NTRIP_SERVER:
893-
if (settings.debugNetworkLayer)
894-
systemPrintln("Network layer stopping NTRIP server");
895-
ntripServerRestart();
896-
break;
897-
898904
case NETWORK_USER_OTA_FIRMWARE_UPDATE:
899905
if (settings.debugNetworkLayer)
900906
systemPrintln("Network layer stopping OTA firmware update");

0 commit comments

Comments
 (0)