Skip to content

Commit 48fe15a

Browse files
authored
Merge pull request #781 from LeeLeahy2/no-ntrip-client
Build with COMPILE_NTRIP_CLIENT commented out
2 parents e6ad378 + f94258c commit 48fe15a

File tree

5 files changed

+58
-47
lines changed

5 files changed

+58
-47
lines changed

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ void networkUserRemove(NETCONSUMER_t consumer, const char * fileName, uint32_t l
6262
void networkValidateIndex(NetIndex_t index) {}
6363
void networkVerifyTables() {}
6464

65-
//----------------------------------------
66-
// NTRIP client
67-
//----------------------------------------
68-
69-
void ntripClientPrintStatus() {systemPrintln("**NTRIP Client not compiled**");}
70-
void ntripClientStop(bool clientAllocated) {online.ntripClient = false;}
71-
void ntripClientUpdate() {}
72-
void ntripClientValidateTables() {}
73-
7465
//----------------------------------------
7566
// TCP client
7667
//----------------------------------------
@@ -145,6 +136,18 @@ void mqttClientValidateTables() {}
145136

146137
#endif // COMPILE_MQTT_CLIENT
147138

139+
//----------------------------------------
140+
// NTRIP client
141+
//----------------------------------------
142+
143+
#ifndef COMPILE_NTRIP_CLIENT
144+
void ntripClientPrintStatus() {systemPrintln("**NTRIP Client not compiled**");}
145+
void ntripClientPushGGA(const char * ggaString) {}
146+
void ntripClientStop(bool clientAllocated) {online.ntripClient = false;}
147+
void ntripClientUpdate() {}
148+
void ntripClientValidateTables() {}
149+
#endif // COMPILE_NTRIP_CLIENT
150+
148151
//----------------------------------------
149152
// NTRIP server
150153
//----------------------------------------

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ GNSS.ino
44
GNSS layer implementation
55
------------------------------------------------------------------------------*/
66

7-
extern int NTRIPCLIENT_MS_BETWEEN_GGA;
8-
9-
#ifdef COMPILE_NETWORK
10-
extern NetworkClient *ntripClient;
11-
#endif // COMPILE_NETWORK
12-
13-
extern unsigned long lastGGAPush;
14-
157
//----------------------------------------
168
// Setup the general configuration of the GNSS
179
// Not Rover or Base specific (ie, baud rates)
@@ -92,38 +84,20 @@ static void pushGPGGA(char *ggaData)
9284

9385
if (xSemaphoreTake(reentrant, 10 / portTICK_PERIOD_MS) == pdPASS)
9486
{
95-
if (ggaData)
96-
{
97-
snprintf(storedGPGGA, sizeof(storedGPGGA), "%s", ggaData);
98-
xSemaphoreGive(reentrant);
99-
return;
100-
}
101-
102-
#ifdef COMPILE_NETWORK
103-
// Wait until the client has been created
104-
if (ntripClient != nullptr)
87+
do
10588
{
106-
// Provide the caster with our current position as needed
107-
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
89+
// Save the ggaData string
90+
if (ggaData)
10891
{
109-
if ((millis() - lastGGAPush) > NTRIPCLIENT_MS_BETWEEN_GGA)
110-
{
111-
lastGGAPush = millis();
112-
113-
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA)) && !inMainMenu)
114-
{
115-
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
116-
systemPrintf("NTRIP Client pushing GGA to server: %s", (const char *)storedGPGGA);
117-
}
118-
119-
// Push our current GGA sentence to caster
120-
if (strlen(storedGPGGA) > 0)
121-
ntripClient->write((const uint8_t *)storedGPGGA, strlen(storedGPGGA));
122-
}
92+
snprintf(storedGPGGA, sizeof(storedGPGGA), "%s", ggaData);
93+
break;
12394
}
124-
}
125-
#endif // COMPILE_NETWORK
12695

96+
// Verify that a GGA string has been saved
97+
if (storedGPGGA[0])
98+
// Push our current GGA sentence to caster
99+
ntripClientPushGGA(storedGPGGA);
100+
} while (0);
127101
xSemaphoreGive(reentrant);
128102
}
129103
}

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ NtripClient.ino
117117
118118
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
119119

120-
#ifdef COMPILE_NETWORK
120+
#ifdef COMPILE_NTRIP_CLIENT
121121

122122
//----------------------------------------
123123
// Constants
@@ -494,6 +494,34 @@ void ntripClientPrintStatus()
494494
}
495495
}
496496

497+
//----------------------------------------
498+
// Push GGA string to the NTRIP caster
499+
//----------------------------------------
500+
void ntripClientPushGGA(const char * ggaString)
501+
{
502+
// Wait until the client has been created
503+
if (ntripClient != nullptr)
504+
{
505+
// Provide the caster with our current position as needed
506+
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
507+
{
508+
if ((millis() - lastGGAPush) > NTRIPCLIENT_MS_BETWEEN_GGA)
509+
{
510+
lastGGAPush = millis();
511+
512+
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA)) && !inMainMenu)
513+
{
514+
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
515+
systemPrintf("NTRIP Client pushing GGA to server: %s", ggaString);
516+
}
517+
518+
// Push the current GGA sentence to caster
519+
ntripClient->write((const uint8_t *)ggaString, strlen(ggaString));
520+
}
521+
}
522+
}
523+
}
524+
497525
//----------------------------------------
498526
// Determine if NTRIP client data is available
499527
//----------------------------------------
@@ -972,4 +1000,4 @@ void ntripClientValidateTables()
9721000
reportFatalError("Fix ntripClientStateNameEntries to match NTRIPClientState");
9731001
}
9741002

975-
#endif // COMPILE_NETWORK
1003+
#endif // COMPILE_NTRIP_CLIENT

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET) || defined(COMPILE_CELLULAR)
117117
#define COMPILE_NETWORK
118118
#define COMPILE_MQTT_CLIENT // Comment out to remove MQTT Client functionality
119+
#define COMPILE_NTRIP_CLIENT // Comment out to remove NTRIP client functionality
119120
#define COMPILE_NTRIP_SERVER // Comment out to remove NTRIP server functionality
120121
#define COMPILE_OTA_AUTO // Comment out to disable automatic over-the-air firmware update
121122
#define COMPILE_HTTP_CLIENT // Comment out to disable HTTP Client (PointPerfect ZTP) functionality

Firmware/RTK_Everywhere/check.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ sed -i 's|#define COMPILE_MOSAICX5|//#define COMPILE_MOSAICX5|' RTK_Everywhere.i
7777
make
7878
git reset --hard --quiet HEAD
7979

80+
# NTRIP Client
81+
sed -i 's|#define COMPILE_NTRIP_CLIENT|//#define COMPILE_NTRIP_CLIENT|' RTK_Everywhere.ino
82+
make
83+
git reset --hard --quiet HEAD
84+
8085
# NTRIP Server
8186
sed -i 's|#define COMPILE_NTRIP_SERVER|//#define COMPILE_NTRIP_SERVER|' RTK_Everywhere.ino
8287
make

0 commit comments

Comments
 (0)