Skip to content

Commit e077f91

Browse files
authored
Merge pull request #23 from sparkfun/release_candidate
Add callbacks for RTCM 1005 and 1006 Input
2 parents 8253ad5 + 97b0ce1 commit e077f91

File tree

5 files changed

+257
-200
lines changed

5 files changed

+257
-200
lines changed

examples/ZED-F9P/Example17_NTRIPClient_With_GGA_Callback/Example17_NTRIPClient_With_GGA_Callback.ino

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,62 @@ void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
144144

145145
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
146146

147+
// Callback: printRTCMdata1005 will be called when new RTCM 1005 data has been parsed from pushRawData
148+
// See u-blox_structs.h for the full definition of RTCM_1005_data_t
149+
// _____ You can use any name you like for the callback. Use the same name when you call setRTCM1005InputcallbackPtr
150+
// / _____ This _must_ be RTCM_1005_data_t
151+
// | / _____ You can use any name you like for the struct
152+
// | | /
153+
// | | |
154+
void printRTCMdata1005(RTCM_1005_data_t *rtcmData1005)
155+
{
156+
double x = rtcmData1005->AntennaReferencePointECEFX;
157+
x /= 10000.0; // Convert to m
158+
double y = rtcmData1005->AntennaReferencePointECEFY;
159+
y /= 10000.0; // Convert to m
160+
double z = rtcmData1005->AntennaReferencePointECEFZ;
161+
z /= 10000.0; // Convert to m
162+
163+
Serial.print(F("NTRIP Server RTCM 1005: ARP ECEF-X: "));
164+
Serial.print(x, 4); // 4 decimal places
165+
Serial.print(F(" Y: "));
166+
Serial.print(y, 4); // 4 decimal places
167+
Serial.print(F(" Z: "));
168+
Serial.println(z, 4); // 4 decimal places
169+
}
170+
171+
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
172+
173+
// Callback: printRTCMdata1006 will be called when new RTCM 1006 data has been parsed from pushRawData
174+
// See u-blox_structs.h for the full definition of RTCM_1006_data_t
175+
// _____ You can use any name you like for the callback. Use the same name when you call setRTCM1006InputcallbackPtr
176+
// / _____ This _must_ be RTCM_1006_data_t
177+
// | / _____ You can use any name you like for the struct
178+
// | | /
179+
// | | |
180+
void printRTCMdata1006(RTCM_1006_data_t *rtcmData1006)
181+
{
182+
double x = rtcmData1006->AntennaReferencePointECEFX;
183+
x /= 10000.0; // Convert to m
184+
double y = rtcmData1006->AntennaReferencePointECEFY;
185+
y /= 10000.0; // Convert to m
186+
double z = rtcmData1006->AntennaReferencePointECEFZ;
187+
z /= 10000.0; // Convert to m
188+
double h = rtcmData1006->AntennaHeight;
189+
h /= 10000.0; // Convert to m
190+
191+
Serial.print(F("NTRIP Server RTCM 1006: ARP ECEF-X: "));
192+
Serial.print(x, 4); // 4 decimal places
193+
Serial.print(F(" Y: "));
194+
Serial.print(y, 4); // 4 decimal places
195+
Serial.print(F(" Z: "));
196+
Serial.print(z, 4); // 4 decimal places
197+
Serial.print(F(" Height: "));
198+
Serial.println(h, 4); // 4 decimal places
199+
}
200+
201+
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
202+
147203
void setup()
148204
{
149205
delay(1000);
@@ -176,6 +232,9 @@ void setup()
176232

177233
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
178234

235+
myGNSS.setRTCM1005InputcallbackPtr(&printRTCMdata1005); // Set up a callback to print the RTCM 1005 Antenna Reference Position from the correction data
236+
myGNSS.setRTCM1006InputcallbackPtr(&printRTCMdata1006); // Set up a callback to print the RTCM 1006 Antenna Reference Position from the correction data
237+
179238
//myGNSS.saveConfiguration(VAL_CFG_SUBSEC_IOPORT | VAL_CFG_SUBSEC_MSGCONF); //Optional: Save the ioPort and message settings to NVM
180239

181240
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -230,54 +289,6 @@ void loop()
230289

231290
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
232291

233-
// Check if the library has been able to extract the Antenna Reference Position from an RTCM 1005 message
234-
235-
RTCM_1005_data_t rtcmData1005;
236-
237-
if (myGNSS.getLatestRTCM1005Input(&rtcmData1005) == 2) // RTCM 1005 data received? 0 = no data, 1 = stale data, 2 = fresh data
238-
{
239-
double x = rtcmData1005.AntennaReferencePointECEFX;
240-
x /= 10000.0; // Convert to m
241-
double y = rtcmData1005.AntennaReferencePointECEFY;
242-
y /= 10000.0; // Convert to m
243-
double z = rtcmData1005.AntennaReferencePointECEFZ;
244-
z /= 10000.0; // Convert to m
245-
246-
Serial.print(F("NTRIP Server RTCM 1005: ARP ECEF-X: "));
247-
Serial.print(x, 4); // 4 decimal places
248-
Serial.print(F(" Y: "));
249-
Serial.print(y, 4); // 4 decimal places
250-
Serial.print(F(" Z: "));
251-
Serial.println(z, 4); // 4 decimal places
252-
}
253-
254-
// Check if the library has been able to extract the Antenna Reference Position from an RTCM 1006 message
255-
256-
RTCM_1006_data_t rtcmData1006;
257-
258-
if (myGNSS.getLatestRTCM1006Input(&rtcmData1006) == 2) // RTCM 1006 data received? 0 = no data, 1 = stale data, 2 = fresh data
259-
{
260-
double x = rtcmData1006.AntennaReferencePointECEFX;
261-
x /= 10000.0; // Convert to m
262-
double y = rtcmData1006.AntennaReferencePointECEFY;
263-
y /= 10000.0; // Convert to m
264-
double z = rtcmData1006.AntennaReferencePointECEFZ;
265-
z /= 10000.0; // Convert to m
266-
double h = rtcmData1006.AntennaHeight;
267-
h /= 10000.0; // Convert to m
268-
269-
Serial.print(F("NTRIP Server RTCM 1006: ARP ECEF-X: "));
270-
Serial.print(x, 4); // 4 decimal places
271-
Serial.print(F(" Y: "));
272-
Serial.print(y, 4); // 4 decimal places
273-
Serial.print(F(" Z: "));
274-
Serial.print(z, 4); // 4 decimal places
275-
Serial.print(F(" Height: "));
276-
Serial.println(h, 4); // 4 decimal places
277-
}
278-
279-
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
280-
281292
switch (state)
282293
{
283294
case open_connection:

keywords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,9 @@ crc24q KEYWORD2
726726
getLatestRTCM1005 KEYWORD2
727727
setRTCM1005callbackPtr KEYWORD2
728728
getLatestRTCM1005Input KEYWORD2
729+
setRTCM1005InputcallbackPtr KEYWORD2
729730
getLatestRTCM1006Input KEYWORD2
731+
setRTCM1006InputcallbackPtr KEYWORD2
730732
extractRTCM1005 KEYWORD2
731733
extractRTCM1006 KEYWORD2
732734

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun u-blox GNSS v3
2-
version=3.0.11
2+
version=3.0.12
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>

0 commit comments

Comments
 (0)