@@ -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}
0 commit comments