Update ZED-F9P callback examples
This commit is contained in:
+16
-16
@@ -41,27 +41,27 @@ SFE_UBLOX_GNSS myGNSS;
|
||||
// | / _____ You can use any name you like for the struct
|
||||
// | | /
|
||||
// | | |
|
||||
void printHPdata(UBX_NAV_HPPOSLLH_data_t ubxDataStruct)
|
||||
void printHPdata(UBX_NAV_HPPOSLLH_data_t *ubxDataStruct)
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
long highResLatitude = ubxDataStruct.lat;
|
||||
long highResLatitude = ubxDataStruct->lat;
|
||||
Serial.print(F("Hi Res Lat: "));
|
||||
Serial.print(highResLatitude);
|
||||
|
||||
int highResLatitudeHp = ubxDataStruct.latHp;
|
||||
int highResLatitudeHp = ubxDataStruct->latHp;
|
||||
Serial.print(F(" "));
|
||||
Serial.print(highResLatitudeHp);
|
||||
|
||||
long highResLongitude = ubxDataStruct.lon;
|
||||
long highResLongitude = ubxDataStruct->lon;
|
||||
Serial.print(F(" Hi Res Long: "));
|
||||
Serial.print(highResLongitude);
|
||||
|
||||
int highResLongitudeHp = ubxDataStruct.lonHp;
|
||||
int highResLongitudeHp = ubxDataStruct->lonHp;
|
||||
Serial.print(F(" "));
|
||||
Serial.print(highResLongitudeHp);
|
||||
|
||||
float horizAccuracy = ((float)ubxDataStruct.hAcc) / 10000.0; // Convert hAcc from mm*0.1 to m
|
||||
float horizAccuracy = ((float)ubxDataStruct->hAcc) / 10000.0; // Convert hAcc from mm*0.1 to m
|
||||
Serial.print(F(" Horiz accuracy: "));
|
||||
Serial.println(horizAccuracy);
|
||||
}
|
||||
@@ -73,38 +73,38 @@ void printHPdata(UBX_NAV_HPPOSLLH_data_t ubxDataStruct)
|
||||
// | / _____ You can use any name you like for the struct
|
||||
// | | /
|
||||
// | | |
|
||||
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
|
||||
void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
Serial.print(F("Time: ")); // Print the time
|
||||
uint8_t hms = ubxDataStruct.hour; // Print the hours
|
||||
uint8_t hms = ubxDataStruct->hour; // Print the hours
|
||||
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
|
||||
Serial.print(hms);
|
||||
Serial.print(F(":"));
|
||||
hms = ubxDataStruct.min; // Print the minutes
|
||||
hms = ubxDataStruct->min; // Print the minutes
|
||||
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
|
||||
Serial.print(hms);
|
||||
Serial.print(F(":"));
|
||||
hms = ubxDataStruct.sec; // Print the seconds
|
||||
hms = ubxDataStruct->sec; // Print the seconds
|
||||
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
|
||||
Serial.print(hms);
|
||||
Serial.print(F("."));
|
||||
unsigned long millisecs = ubxDataStruct.iTOW % 1000; // Print the milliseconds
|
||||
unsigned long millisecs = ubxDataStruct->iTOW % 1000; // Print the milliseconds
|
||||
if (millisecs < 100) Serial.print(F("0")); // Print the trailing zeros correctly
|
||||
if (millisecs < 10) Serial.print(F("0"));
|
||||
Serial.print(millisecs);
|
||||
|
||||
long latitude = ubxDataStruct.lat; // Print the latitude
|
||||
long latitude = ubxDataStruct->lat; // Print the latitude
|
||||
Serial.print(F(" Lat: "));
|
||||
Serial.print(latitude);
|
||||
|
||||
long longitude = ubxDataStruct.lon; // Print the longitude
|
||||
long longitude = ubxDataStruct->lon; // Print the longitude
|
||||
Serial.print(F(" Long: "));
|
||||
Serial.print(longitude);
|
||||
Serial.print(F(" (degrees * 10^-7)"));
|
||||
|
||||
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
|
||||
long altitude = ubxDataStruct->hMSL; // Print the height above mean sea level
|
||||
Serial.print(F(" Height above MSL: "));
|
||||
Serial.print(altitude);
|
||||
Serial.println(F(" (mm)"));
|
||||
@@ -135,9 +135,9 @@ void setup()
|
||||
|
||||
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
|
||||
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
||||
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
||||
|
||||
myGNSS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
|
||||
myGNSS.setAutoHPPOSLLHcallbackPtr(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in New Issue
Block a user