Skip to content

v2.2.8 #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ v2.1 of the library adds support for u-blox AssistNow<sup>TM</sup> Assisted GNSS
This library is the new and improved version of the very popular SparkFun u-blox GNSS Arduino Library. v2.0 contains some big changes and improvements:

* Seamless support for "automatic" message delivery:
* In v1.8, you could ask for the NAV PVT (Navigation Position Velocity Time) message to be delivered _automatically_, without polling. v2.0 adds automatic support for [**26 messages**](./Theory.md#auto-messages), covering the full range of: standard and High Precision position, velocity, attitude and time information; relative positioning; event capture with nanosecond time resolution; raw GNSS signal data including carrier phase; Sensor Fusion; and High Navigation Rate data.
* In v1.8, you could ask for the NAV PVT (Navigation Position Velocity Time) message to be delivered _automatically_, without polling. v2.0 adds automatic support for [**27 messages**](./Theory.md#auto-messages), covering the full range of: standard and High Precision position, velocity, attitude and time information; relative positioning; event capture with nanosecond time resolution; raw GNSS signal data including carrier phase; Sensor Fusion; and High Navigation Rate data.
* Don't see the message you really need? [Adding_New_Messages](./Adding_New_Messages.md) provides details on how to add "auto" support for your favourite message.
* Dynamic memory allocation with clearly-defined data storage structs for each message:
* There are no static 'global' variables to eat up your RAM. v2.0 automatically allocates memory for the automatic messages when they are enabled. You may find your total RAM use is lower with v2.0 than with v1.8.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
Configuring the GNSS to automatically send NAV SVIN reports over I2C and display them using a callback
By: Paul Clark
SparkFun Electronics
Date: April 4th, 2022
License: MIT. See license file for more information but you can
basically do whatever you want with this code.

This example shows how to configure the u-blox GNSS to send NAV SVIN reports automatically
and access the data via a callback. No more polling!

Feel like supporting open source hardware?
Buy a board from SparkFun!
ZED-F9P RTK2: https://www.sparkfun.com/products/15136

Hardware Connections:
Plug a Qwiic cable into the GPS and a BlackBoard
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
Open the serial monitor at 115200 baud to see the output
*/

#include <Wire.h> //Needed for I2C to GNSS

#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;

// Callback: newNAVSVIN will be called when new NAV SVIN data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_SVIN_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVSVINcallbackPtr
// / _____ This _must_ be UBX_NAV_SVIN_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void newNAVSVIN(UBX_NAV_SVIN_data_t *ubxDataStruct)
{
Serial.println();

Serial.print(F("Survey-in is "));
if (ubxDataStruct->active == 0)
Serial.print(F("not "));
Serial.println(F("in progress"));

Serial.print(F("Survey-in position is "));
if (ubxDataStruct->valid == 0)
Serial.print(F("not "));
Serial.println(F("valid"));

Serial.print(F("Survey-in observation time (s): "));
Serial.println(ubxDataStruct->dur);

Serial.print(F("ECEF position (cm): "));
Serial.print(ubxDataStruct->meanX);
Serial.print(F(" ("));
if (ubxDataStruct->meanXHP >= 0)
Serial.print(F("+"));
Serial.print((float)ubxDataStruct->meanXHP * 0.01); // Convert 0.1mm to cm
Serial.print(F("), "));
Serial.print(ubxDataStruct->meanY);
Serial.print(F(" ("));
if (ubxDataStruct->meanYHP >= 0)
Serial.print(F("+"));
Serial.print((float)ubxDataStruct->meanYHP * 0.01); // Convert 0.1mm to cm
Serial.print(F("), "));
Serial.print(ubxDataStruct->meanZ);
Serial.print(F(" ("));
if (ubxDataStruct->meanZHP >= 0)
Serial.print(F("+"));
Serial.print((float)ubxDataStruct->meanZHP * 0.01); // Convert 0.1mm to cm
Serial.println(F(")"));

Serial.print(F("Mean position accuracy (cm): "));
Serial.println((float)ubxDataStruct->meanAcc * 0.01); // Convert 0.1mm to cm
}

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("u-blox Base Station example"));

Wire.begin();

//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial

if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
{
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}

// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
//myGNSS.factoryDefault(); delay(5000);

myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR

// Set up the callback for NAV SVIN. This will enable SVIN messages at the navigation rate
myGNSS.setAutoNAVSVINcallbackPtr(&newNAVSVIN);

while (Serial.available()) Serial.read(); //Clear the serial buffer
Serial.println(F("Press any key to begin Survey-In"));
}

void loop()
{
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
myGNSS.checkCallbacks(); //Process any waiting callbacks

if (Serial.available()) // Check if user has pressed a key
{
bool success = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
//bool success = myGNSS.enableSurveyModeFull(86400, 2.000); //Enable Survey in, 24 hours, 2.0m

Serial.println();

if (success)
{
Serial.println(F("Survey-In started!"));
}
else
{
Serial.println(F("Survey start failed!"));
}

while (Serial.available()) Serial.read(); //Clear the serial buffer
}
}
33 changes: 6 additions & 27 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ setAutoNAVPOSECEFrate KEYWORD2
setAutoNAVPOSECEFcallback KEYWORD2
setAutoNAVPOSECEFcallbackPtr KEYWORD2
assumeAutoNAVPOSECEF KEYWORD2
initPacketUBXNAVPOSECEF KEYWORD2
flushNAVPOSECEF KEYWORD2
logNAVPOSECEF KEYWORD2

Expand All @@ -248,7 +247,6 @@ setAutoNAVSTATUSrate KEYWORD2
setAutoNAVSTATUScallback KEYWORD2
setAutoNAVSTATUScallbackPtr KEYWORD2
assumeAutoNAVSTATUS KEYWORD2
initPacketUBXNAVSTATUS KEYWORD2
flushNAVSTATUS KEYWORD2
logNAVSTATUS KEYWORD2

Expand All @@ -258,7 +256,6 @@ setAutoDOPrate KEYWORD2
setAutoDOPcallback KEYWORD2
setAutoDOPcallbackPtr KEYWORD2
assumeAutoDOP KEYWORD2
initPacketUBXNAVDOP KEYWORD2
flushDOP KEYWORD2
logNAVDOP KEYWORD2

Expand All @@ -269,7 +266,6 @@ setAutoNAVATTrate KEYWORD2
setAutoNAVATTcallback KEYWORD2
setAutoNAVATTcallbackPtr KEYWORD2
assumeAutoNAVATT KEYWORD2
initPacketUBXNAVATT KEYWORD2
flushNAVATT KEYWORD2
logNAVATT KEYWORD2

Expand All @@ -279,7 +275,6 @@ setAutoPVTrate KEYWORD2
setAutoPVTcallback KEYWORD2
setAutoPVTcallbackPtr KEYWORD2
assumeAutoPVT KEYWORD2
initPacketUBXNAVPVT KEYWORD2
flushPVT KEYWORD2
logNAVPVT KEYWORD2

Expand All @@ -289,7 +284,6 @@ setAutoNAVODOrate KEYWORD2
setAutoNAVODOcallback KEYWORD2
setAutoNAVODOcallbackPtr KEYWORD2
assumeAutoNAVODO KEYWORD2
initPacketUBXNAVODO KEYWORD2
flushNAVODO KEYWORD2
logNAVODO KEYWORD2

Expand All @@ -299,7 +293,6 @@ setAutoNAVVELECEFrate KEYWORD2
setAutoNAVVELECEFcallback KEYWORD2
setAutoNAVVELECEFcallbackPtr KEYWORD2
assumeAutoNAVVELECEF KEYWORD2
initPacketUBXNAVVELECEF KEYWORD2
flushNAVVELECEF KEYWORD2
logNAVVELECEF KEYWORD2

Expand All @@ -309,7 +302,6 @@ setAutoNAVVELNEDrate KEYWORD2
setAutoNAVVELNEDcallback KEYWORD2
setAutoNAVVELNEDcallbackPtr KEYWORD2
assumeAutoNAVVELNED KEYWORD2
initPacketUBXNAVVELNED KEYWORD2
flushNAVVELNED KEYWORD2
logNAVVELNED KEYWORD2

Expand All @@ -319,7 +311,6 @@ setAutoNAVHPPOSECEFrate KEYWORD2
setAutoNAVHPPOSECEFcallback KEYWORD2
setAutoNAVHPPOSECEFcallbackPtr KEYWORD2
assumeAutoNAVHPPOSECEF KEYWORD2
initPacketUBXNAVHPPOSECEF KEYWORD2
flushNAVHPPOSECEF KEYWORD2
logNAVHPPOSECEF KEYWORD2

Expand All @@ -329,7 +320,6 @@ setAutoHPPOSLLHrate KEYWORD2
setAutoHPPOSLLHcallback KEYWORD2
setAutoHPPOSLLHcallbackPtr KEYWORD2
assumeAutoHPPOSLLH KEYWORD2
initPacketUBXNAVHPPOSLLH KEYWORD2
flushHPPOSLLH KEYWORD2
logNAVHPPOSLLH KEYWORD2

Expand All @@ -349,25 +339,27 @@ setAutoNAVCLOCKrate KEYWORD2
setAutoNAVCLOCKcallback KEYWORD2
setAutoNAVCLOCKcallbackPtr KEYWORD2
assumeAutoNAVCLOCK KEYWORD2
initPacketUBXNAVCLOCK KEYWORD2
flushNAVCLOCK KEYWORD2
logNAVCLOCK KEYWORD2

getLeapSecondEvent KEYWORD2
getLeapIndicator KEYWORD2
getCurrentLeapSeconds KEYWORD2
initPacketUBXNAVTIMELS KEYWORD2

getSurveyStatus KEYWORD2
initPacketUBXNAVSVIN KEYWORD2
setAutoNAVSVIN KEYWORD2
setAutoNAVSVINrate KEYWORD2
setAutoNAVSVINcallbackPtr KEYWORD2
assumeAutoNAVSVIN KEYWORD2
flushNAVSVIN KEYWORD2
logNAVSVIN KEYWORD2

getNAVSAT KEYWORD2
setAutoNAVSAT KEYWORD2
setAutoNAVSATrate KEYWORD2
setAutoNAVSATcallback KEYWORD2
setAutoNAVSATcallbackPtr KEYWORD2
assumeAutoNAVSAT KEYWORD2
initPacketUBXNAVSAT KEYWORD2
flushNAVSAT KEYWORD2
logNAVSAT KEYWORD2

Expand All @@ -377,7 +369,6 @@ setAutoRELPOSNEDrate KEYWORD2
setAutoRELPOSNEDcallback KEYWORD2
setAutoRELPOSNEDcallbackPtr KEYWORD2
assumeAutoRELPOSNED KEYWORD2
initPacketUBXNAVRELPOSNED KEYWORD2
flushNAVRELPOSNED KEYWORD2
logNAVRELPOSNED KEYWORD2

Expand All @@ -387,7 +378,6 @@ setAutoAOPSTATUSrate KEYWORD2
setAutoAOPSTATUScallback KEYWORD2
setAutoAOPSTATUScallbackPtr KEYWORD2
assumeAutoAOPSTATUS KEYWORD2
initPacketUBXAOPSTATUS KEYWORD2
flushAOPSTATUS KEYWORD2
logAOPSTATUS KEYWORD2

Expand All @@ -402,7 +392,6 @@ setAutoRXMSFRBXrate KEYWORD2
setAutoRXMSFRBXcallback KEYWORD2
setAutoRXMSFRBXcallbackPtr KEYWORD2
assumeAutoRXMSFRBX KEYWORD2
initPacketUBXRXMSFRBX KEYWORD2
flushRXMSFRBX KEYWORD2
logRXMSFRBX KEYWORD2

Expand All @@ -412,7 +401,6 @@ setAutoRXMRAWXrate KEYWORD2
setAutoRXMRAWXcallback KEYWORD2
setAutoRXMRAWXcallbackPtr KEYWORD2
assumeAutoRXMRAWX KEYWORD2
initPacketUBXRXMRAWX KEYWORD2
flushRXMRAWX KEYWORD2
logRXMRAWX KEYWORD2

Expand All @@ -422,7 +410,6 @@ setAutoTIMTM2rate KEYWORD2
setAutoTIMTM2callback KEYWORD2
setAutoTIMTM2callbackPtr KEYWORD2
assumeAutoTIMTM2 KEYWORD2
initPacketUBXTIMTM2 KEYWORD2
flushTIMTM2 KEYWORD2
logTIMTM2 KEYWORD2

Expand All @@ -433,7 +420,6 @@ setAutoESFALGrate KEYWORD2
setAutoESFALGcallback KEYWORD2
setAutoESFALGcallbackPtr KEYWORD2
assumeAutoESFALG KEYWORD2
initPacketUBXESFALG KEYWORD2
flushESFALG KEYWORD2
logESFALG KEYWORD2

Expand All @@ -444,7 +430,6 @@ setAutoESFSTATUSrate KEYWORD2
setAutoESFSTATUScallback KEYWORD2
setAutoESFSTATUScallbackPtr KEYWORD2
assumeAutoESFSTATUS KEYWORD2
initPacketUBXESFSTATUS KEYWORD2
flushESFSTATUS KEYWORD2
logESFSTATUS KEYWORD2

Expand All @@ -455,7 +440,6 @@ setAutoESFINSrate KEYWORD2
setAutoESFINScallback KEYWORD2
setAutoESFINScallbackPtr KEYWORD2
assumeAutoESFINS KEYWORD2
initPacketUBXESFINS KEYWORD2
flushESFINS KEYWORD2
logESFINS KEYWORD2

Expand All @@ -466,7 +450,6 @@ setAutoESFMEASrate KEYWORD2
setAutoESFMEAScallback KEYWORD2
setAutoESFMEAScallbackPtr KEYWORD2
assumeAutoESFMEAS KEYWORD2
initPacketUBXESFMEAS KEYWORD2
flushESFMEAS KEYWORD2
logESFMEAS KEYWORD2

Expand All @@ -477,7 +460,6 @@ setAutoESFRAWrate KEYWORD2
setAutoESFRAWcallback KEYWORD2
setAutoESFRAWcallbackPtr KEYWORD2
assumeAutoESFRAW KEYWORD2
initPacketUBXESFRAW KEYWORD2
flushESFRAW KEYWORD2
logESFRAW KEYWORD2

Expand All @@ -488,7 +470,6 @@ setAutoHNRATTrate KEYWORD2
setAutoHNRATTcallback KEYWORD2
setAutoHNRATTcallbackPtr KEYWORD2
assumeAutoHNRATT KEYWORD2
initPacketUBXHNRATT KEYWORD2
flushHNRATT KEYWORD2
logHNRATT KEYWORD2

Expand All @@ -499,7 +480,6 @@ setAutoHNRINSrate KEYWORD2
setAutoHNRINScallback KEYWORD2
setAutoHNRINScallbackPtr KEYWORD2
assumeAutoHNRINS KEYWORD2
initPacketUBXHNRINS KEYWORD2
flushHNRINS KEYWORD2
logHNRINS KEYWORD2

Expand All @@ -509,7 +489,6 @@ setAutoHNRPVTrate KEYWORD2
setAutoHNRPVTcallback KEYWORD2
setAutoHNRPVTcallbackPtr KEYWORD2
assumeAutoHNRPVT KEYWORD2
initPacketUBXHNRPVT KEYWORD2
flushHNRPVT KEYWORD2
logHNRPVT KEYWORD2

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library
version=2.2.7
version=2.2.8
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
Expand Down
Loading