Skip to content

Commit 9a486f9

Browse files
committed
Update ZED-F9P callback examples
1 parent 7395c25 commit 9a486f9

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

examples/ZED-F9P/Example13_autoHPPOSLLH_with_Callback/Example13_autoHPPOSLLH_with_Callback.ino

+16-16
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ SFE_UBLOX_GNSS myGNSS;
4141
// | / _____ You can use any name you like for the struct
4242
// | | /
4343
// | | |
44-
void printHPdata(UBX_NAV_HPPOSLLH_data_t ubxDataStruct)
44+
void printHPdata(UBX_NAV_HPPOSLLH_data_t *ubxDataStruct)
4545
{
4646
Serial.println();
4747

48-
long highResLatitude = ubxDataStruct.lat;
48+
long highResLatitude = ubxDataStruct->lat;
4949
Serial.print(F("Hi Res Lat: "));
5050
Serial.print(highResLatitude);
5151

52-
int highResLatitudeHp = ubxDataStruct.latHp;
52+
int highResLatitudeHp = ubxDataStruct->latHp;
5353
Serial.print(F(" "));
5454
Serial.print(highResLatitudeHp);
5555

56-
long highResLongitude = ubxDataStruct.lon;
56+
long highResLongitude = ubxDataStruct->lon;
5757
Serial.print(F(" Hi Res Long: "));
5858
Serial.print(highResLongitude);
5959

60-
int highResLongitudeHp = ubxDataStruct.lonHp;
60+
int highResLongitudeHp = ubxDataStruct->lonHp;
6161
Serial.print(F(" "));
6262
Serial.print(highResLongitudeHp);
6363

64-
float horizAccuracy = ((float)ubxDataStruct.hAcc) / 10000.0; // Convert hAcc from mm*0.1 to m
64+
float horizAccuracy = ((float)ubxDataStruct->hAcc) / 10000.0; // Convert hAcc from mm*0.1 to m
6565
Serial.print(F(" Horiz accuracy: "));
6666
Serial.println(horizAccuracy);
6767
}
@@ -73,38 +73,38 @@ void printHPdata(UBX_NAV_HPPOSLLH_data_t ubxDataStruct)
7373
// | / _____ You can use any name you like for the struct
7474
// | | /
7575
// | | |
76-
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
76+
void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
7777
{
7878
Serial.println();
7979

8080
Serial.print(F("Time: ")); // Print the time
81-
uint8_t hms = ubxDataStruct.hour; // Print the hours
81+
uint8_t hms = ubxDataStruct->hour; // Print the hours
8282
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
8383
Serial.print(hms);
8484
Serial.print(F(":"));
85-
hms = ubxDataStruct.min; // Print the minutes
85+
hms = ubxDataStruct->min; // Print the minutes
8686
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
8787
Serial.print(hms);
8888
Serial.print(F(":"));
89-
hms = ubxDataStruct.sec; // Print the seconds
89+
hms = ubxDataStruct->sec; // Print the seconds
9090
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
9191
Serial.print(hms);
9292
Serial.print(F("."));
93-
unsigned long millisecs = ubxDataStruct.iTOW % 1000; // Print the milliseconds
93+
unsigned long millisecs = ubxDataStruct->iTOW % 1000; // Print the milliseconds
9494
if (millisecs < 100) Serial.print(F("0")); // Print the trailing zeros correctly
9595
if (millisecs < 10) Serial.print(F("0"));
9696
Serial.print(millisecs);
9797

98-
long latitude = ubxDataStruct.lat; // Print the latitude
98+
long latitude = ubxDataStruct->lat; // Print the latitude
9999
Serial.print(F(" Lat: "));
100100
Serial.print(latitude);
101101

102-
long longitude = ubxDataStruct.lon; // Print the longitude
102+
long longitude = ubxDataStruct->lon; // Print the longitude
103103
Serial.print(F(" Long: "));
104104
Serial.print(longitude);
105105
Serial.print(F(" (degrees * 10^-7)"));
106106

107-
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
107+
long altitude = ubxDataStruct->hMSL; // Print the height above mean sea level
108108
Serial.print(F(" Height above MSL: "));
109109
Serial.print(altitude);
110110
Serial.println(F(" (mm)"));
@@ -135,9 +135,9 @@ void setup()
135135

136136
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
137137

138-
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
138+
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
139139

140-
myGNSS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
140+
myGNSS.setAutoHPPOSLLHcallbackPtr(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
141141
}
142142

143143
void loop()

examples/ZED-F9P/Example17_NTRIPClient_With_GGA_Callback/Example17_NTRIPClient_With_GGA_Callback.ino

+12-12
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ WiFiClient ntripClient; // The WiFi connection to the NTRIP server. This is glob
6969
// | / _____ You can use any name you like for the struct
7070
// | | /
7171
// | | |
72-
void pushGPGGA(NMEA_GGA_data_t nmeaData)
72+
void pushGPGGA(NMEA_GGA_data_t *nmeaData)
7373
{
7474
//Provide the caster with our current position as needed
7575
if ((ntripClient.connected() == true) && (transmitLocation == true))
7676
{
7777
Serial.print(F("Pushing GGA to server: "));
78-
Serial.print((const char *)nmeaData.nmea); // .nmea is printable (NULL-terminated) and already has \r\n on the end
78+
Serial.print((const char *)nmeaData->nmea); // .nmea is printable (NULL-terminated) and already has \r\n on the end
7979

8080
//Push our current GGA sentence to caster
81-
ntripClient.print((const char *)nmeaData.nmea);
81+
ntripClient.print((const char *)nmeaData->nmea);
8282
}
8383
}
8484

@@ -91,26 +91,26 @@ void pushGPGGA(NMEA_GGA_data_t nmeaData)
9191
// | / _____ You can use any name you like for the struct
9292
// | | /
9393
// | | |
94-
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
94+
void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
9595
{
96-
long latitude = ubxDataStruct.lat; // Print the latitude
96+
long latitude = ubxDataStruct->lat; // Print the latitude
9797
Serial.print(F("Lat: "));
9898
Serial.print(latitude / 10000000L);
9999
Serial.print(F("."));
100100
Serial.print(abs(latitude % 10000000L));
101101

102-
long longitude = ubxDataStruct.lon; // Print the longitude
102+
long longitude = ubxDataStruct->lon; // Print the longitude
103103
Serial.print(F(" Long: "));
104104
Serial.print(longitude / 10000000L);
105105
Serial.print(F("."));
106106
Serial.print(abs(longitude % 10000000L));
107107

108-
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
108+
long altitude = ubxDataStruct->hMSL; // Print the height above mean sea level
109109
Serial.print(F(" Height: "));
110110
Serial.print(altitude);
111111
Serial.print(F(" (mm)"));
112112

113-
uint8_t fixType = ubxDataStruct.fixType; // Print the fix type
113+
uint8_t fixType = ubxDataStruct->fixType; // Print the fix type
114114
Serial.print(F(" Fix: "));
115115
Serial.print(fixType);
116116
if (fixType == 0)
@@ -128,7 +128,7 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
128128
else
129129
Serial.print(F(" (UNKNOWN)"));
130130

131-
uint8_t carrSoln = ubxDataStruct.flags.bits.carrSoln; // Print the carrier solution
131+
uint8_t carrSoln = ubxDataStruct->flags.bits.carrSoln; // Print the carrier solution
132132
Serial.print(F(" Carrier Solution: "));
133133
Serial.print(carrSoln);
134134
if (carrSoln == 0)
@@ -140,7 +140,7 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
140140
else
141141
Serial.print(F(" (UNKNOWN)"));
142142

143-
uint32_t hAcc = ubxDataStruct.hAcc; // Print the horizontal accuracy estimate
143+
uint32_t hAcc = ubxDataStruct->hAcc; // Print the horizontal accuracy estimate
144144
Serial.print(F(" Horizontal Accuracy Estimate: "));
145145
Serial.print(hAcc);
146146
Serial.print(F(" (mm)"));
@@ -175,11 +175,11 @@ void setup()
175175
// Set the Main Talker ID to "GP". The NMEA GGA messages will be GPGGA instead of GNGGA
176176
myGNSS.setMainTalkerID(SFE_UBLOX_MAIN_TALKER_ID_GP);
177177

178-
myGNSS.setNMEAGPGGAcallback(&pushGPGGA); // Set up the callback for GPGGA
178+
myGNSS.setNMEAGPGGAcallbackPtr(&pushGPGGA); // Set up the callback for GPGGA
179179

180180
myGNSS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C, 10); // Tell the module to output GGA every 10 seconds
181181

182-
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
182+
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
183183

184184
//myGNSS.saveConfiguration(VAL_CFG_SUBSEC_IOPORT | VAL_CFG_SUBSEC_MSGCONF); //Optional: Save the ioPort and message settings to NVM
185185

0 commit comments

Comments
 (0)