Skip to content

Commit 10d5a92

Browse files
committed
Push GGA on non ZED platforms
Fix #515
1 parent 2b9a61a commit 10d5a92

File tree

4 files changed

+50
-35
lines changed

4 files changed

+50
-35
lines changed

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ 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+
715
//----------------------------------------
816
// Setup the general configuration of the GNSS
917
// Not Rover or Base specific (ie, baud rates)
@@ -46,3 +54,31 @@ bool GNSS::setMinCno(uint8_t cnoValue)
4654
// Pass the value to the GNSS receiver
4755
return gnss->setMinCnoRadio(cnoValue);
4856
}
57+
58+
// Periodically push GGA sentence over NTRIP Client, to Caster, if enabled
59+
void pushGPGGA(char *ggaData)
60+
{
61+
#ifdef COMPILE_NETWORK
62+
// Wait until the client has been created
63+
if (ntripClient != nullptr)
64+
{
65+
// Provide the caster with our current position as needed
66+
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
67+
{
68+
if (millis() - lastGGAPush > NTRIPCLIENT_MS_BETWEEN_GGA)
69+
{
70+
lastGGAPush = millis();
71+
72+
if (settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA))
73+
{
74+
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
75+
systemPrintf("NTRIP Client pushing GGA to server: %s", (const char *)ggaData);
76+
}
77+
78+
// Push our current GGA sentence to caster
79+
ntripClient->print((const char *)ggaData);
80+
}
81+
}
82+
}
83+
#endif // COMPILE_NETWORK
84+
}

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ GNSS_ZED.ino
66

77
#ifdef COMPILE_ZED
88

9-
extern int NTRIPCLIENT_MS_BETWEEN_GGA;
10-
11-
#ifdef COMPILE_NETWORK
12-
extern NetworkClient *ntripClient;
13-
#endif // COMPILE_NETWORK
14-
15-
extern unsigned long lastGGAPush;
16-
179
//----------------------------------------
1810
// If we have decryption keys, configure module
1911
// Note: don't check online.lband_neo here. We could be using ip corrections
@@ -865,7 +857,7 @@ void GNSS_ZED::enableGgaForNtrip()
865857
{
866858
// Set the Main Talker ID to "GP". The NMEA GGA messages will be GPGGA instead of GNGGA
867859
_zed->setVal8(UBLOX_CFG_NMEA_MAINTALKERID, 1);
868-
_zed->setNMEAGPGGAcallbackPtr(&pushGPGGA); // Set up the callback for GPGGA
860+
_zed->setNMEAGPGGAcallbackPtr(&zedPushGPGGA); // Set up the callback for GPGGA
869861

870862
float measurementFrequency = (1000.0 / settings.measurementRateMs) / settings.navigationRate;
871863
if (measurementFrequency < 0.2)
@@ -2768,30 +2760,6 @@ void checkRXMCOR(UBX_RXM_COR_data_t *ubxDataStruct)
27682760
}
27692761
}
27702762

2771-
// Call back for incoming GGA data to be pushed to NTRIP Caster
2772-
void pushGPGGA(NMEA_GGA_data_t *nmeaData)
2773-
{
2774-
#ifdef COMPILE_NETWORK
2775-
// Provide the caster with our current position as needed
2776-
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
2777-
{
2778-
if (millis() - lastGGAPush > NTRIPCLIENT_MS_BETWEEN_GGA)
2779-
{
2780-
lastGGAPush = millis();
2781-
2782-
if (settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA))
2783-
{
2784-
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
2785-
systemPrintf("NTRIP Client pushing GGA to server: %s", (const char *)nmeaData->nmea);
2786-
}
2787-
2788-
// Push our current GGA sentence to caster
2789-
ntripClient->print((const char *)nmeaData->nmea);
2790-
}
2791-
}
2792-
#endif // COMPILE_NETWORK
2793-
}
2794-
27952763
// ZED-F9x call back
27962764
void eventTriggerReceived(UBX_TIM_TM2_data_t *ubxDataStruct)
27972765
{
@@ -2911,4 +2879,11 @@ void inputMessageRate(uint8_t &localMessageRate, uint8_t messageNumber)
29112879
localMessageRate = rate;
29122880
}
29132881

2882+
// Push GGA sentence over NTRIP Client, to Caster, if enabled
2883+
// ZED uses callback, other platforms call this from processUart1Message()
2884+
void zedPushGPGGA(NMEA_GGA_data_t *nmeaData)
2885+
{
2886+
pushGPGGA((char *)nmeaData->nmea);
2887+
}
2888+
29142889
#endif // COMPILE_ZED

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,6 @@ void ntripClientUpdate()
598598
// Failed to connect to to the network, attempt to restart the network
599599
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
600600

601-
602-
603601
// If GGA transmission is enabled, wait for GNSS lock before connecting to NTRIP Caster
604602
// If GGA transmission is not enabled, start connecting to NTRIP Caster
605603
else if ((settings.ntripClient_TransmitGGA == false) || (gnss->isFixed() == true))

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,12 @@ void processUart1Message(SEMP_PARSE_STATE *parse, uint16_t type)
747747
}
748748
}
749749

750+
// Push GGA to Caster if enabled
751+
if (type == RTK_NMEA_PARSER_INDEX && strstr(sempNmeaGetSentenceName(parse), "GGA") != nullptr)
752+
{
753+
pushGPGGA((char *)parse->buffer);
754+
}
755+
750756
// Determine if this message will fit into the ring buffer
751757
bytesToCopy = parse->length;
752758
space = availableHandlerSpace;

0 commit comments

Comments
 (0)