Merge pull request #17 from sparkfun/release_candidate

v2.0.4
This commit is contained in:
Paul
2021-03-30 11:47:18 +01:00
committed by GitHub
8 changed files with 558 additions and 38 deletions
@@ -0,0 +1,107 @@
/*
Configuring the GNSS to automatically send RXM RZWX reports over I2C and display them using a callback
By: Paul Clark
SparkFun Electronics
Date: March 11th, 2021
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 RXM RAWX 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 GPS
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
// Callback: newRAWX will be called when new RXM RAWX data arrives
// See u-blox_structs.h for the full definition of UBX_RXMRAWX_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoRXMRAWXcallback
// / _____ This _must_ be UBX_RXM_RAWX_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void newRAWX(UBX_RXM_RAWX_data_t ubxDataStruct)
{
Serial.println();
Serial.print(F("New RAWX data received. It contains "));
Serial.print(ubxDataStruct.header.numMeas); // Print numMeas (Number of measurements / blocks)
Serial.println(F(" data blocks:"));
for (uint8_t block = 0; block < ubxDataStruct.header.numMeas; block++) // For each block
{
Serial.print(F("GNSS ID: "));
if (ubxDataStruct.blocks[block].gnssId < 100) Serial.print(F(" ")); // Align the gnssId
if (ubxDataStruct.blocks[block].gnssId < 10) Serial.print(F(" ")); // Align the gnssId
Serial.print(ubxDataStruct.blocks[block].gnssId);
Serial.print(F(" SV ID: "));
if (ubxDataStruct.blocks[block].svId < 100) Serial.print(F(" ")); // Align the svId
if (ubxDataStruct.blocks[block].svId < 10) Serial.print(F(" ")); // Align the svId
Serial.print(ubxDataStruct.blocks[block].svId);
if (sizeof(double) == 8) // Check if our processor supports 64-bit double
{
// Convert prMes from uint8_t[8] to 64-bit double
// prMes is little-endian
double pseudorange;
memcpy(&pseudorange, &ubxDataStruct.blocks[block].prMes, 8);
Serial.print(F(" PR: "));
Serial.print(pseudorange, 3);
// Convert cpMes from uint8_t[8] to 64-bit double
// cpMes is little-endian
double carrierPhase;
memcpy(&carrierPhase, &ubxDataStruct.blocks[block].cpMes, 8);
Serial.print(F(" m CP: "));
Serial.print(carrierPhase, 3);
Serial.print(F(" cycles"));
}
Serial.println();
}
}
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println("SparkFun u-blox Example");
Wire.begin();
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
myGNSS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
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);
}
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
myGNSS.setNavigationFrequency(1); //Produce one solution per second (RAWX produces a _lot_ of data!)
myGNSS.setAutoRXMRAWXcallback(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
}
void loop()
{
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
Serial.print(".");
delay(50);
}
@@ -0,0 +1,108 @@
/*
Getting Unix Epoch Time and micros using u-blox commands
By: UT2UH
Date: March 30th, 2021
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
This example shows how to query a u-blox module for the current time and date as Unix Epoch uint32_t type to avoid time.h dependency.
We also turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic dramatically.
Note: this example works best on modules like the ZED_F9P. Modules like the ZOE_M8Q do not support confirmedTime.
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
Feel like supporting open source hardware?
Buy a board from SparkFun!
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
NEO-M8P RTK: https://www.sparkfun.com/products/15005
SAM-M8Q: https://www.sparkfun.com/products/15106
Hardware Connections:
Plug a Qwiic cable into the GNSS 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;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
void setup()
{
Serial.begin(115200);
while (!Serial)
; //Wait for user to open terminal
Serial.println("SparkFun u-blox Example");
Wire.begin();
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 need to completely reset your module
//myGNSS.factoryDefault(); delay(5000); // Reset everything and wait while the module restarts
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
Serial.println("Compare Unix Epoch given with reference one from https://www.epochconverter.com/");
}
void loop()
{
//Query module only every second. Doing it more often will just cause I2C traffic.
//The module only responds when a new position is available
if (millis() - lastTime > 1000)
{
lastTime = millis(); //Update the timer
// getUnixEpoch marks the PVT data as stale so you will get Unix time and PVT time on alternate seconds
uint32_t us; //microseconds returned by getUnixEpoch()
uint32_t epoch = myGNSS.getUnixEpoch(us);
Serial.print("Unix Epoch: ");
Serial.print(epoch, DEC);
Serial.print(" micros: ");
Serial.println(us, DEC);
Serial.print(myGNSS.getYear());
Serial.print("-");
Serial.print(myGNSS.getMonth());
Serial.print("-");
Serial.print(myGNSS.getDay());
Serial.print(" ");
Serial.print(myGNSS.getHour());
Serial.print(":");
Serial.print(myGNSS.getMinute());
Serial.print(":");
Serial.print(myGNSS.getSecond());
Serial.print(" Time is ");
if (myGNSS.getTimeValid() == false)
{
Serial.print("not ");
}
Serial.print("valid ");
if (myGNSS.getConfirmedTime() == false)
{
Serial.print("but not ");
} else {
Serial.print("and ");
}
Serial.print("confirmed");
byte SIV = myGNSS.getSIV();
Serial.print(F(" SIV: "));
Serial.println(SIV);
}
}
@@ -0,0 +1,123 @@
/*
Demonstrate get/setMeasurementRate and get/setNavigationRate
By: Paul Clark
SparkFun Electronics
Date: March 30th, 2021
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
This example shows how to slow down the measurement and navigation rates.
This should run on any GNSS module but has only been tested on the ZED_F9P and ZOE_M8Q.
Feel like supporting open source hardware?
Buy a board from SparkFun!
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
NEO-M8P RTK: https://www.sparkfun.com/products/15005
SAM-M8Q: https://www.sparkfun.com/products/15106
Hardware Connections:
Plug a Qwiic cable into the GNSS 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;
unsigned long lastTime = 0; //Simple local timer. Used to calc the message interval.
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println("SparkFun u-blox Example");
Wire.begin();
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful 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 need to completely reset your module
//myGNSS.factoryDefault(); delay(5000); // Reset everything and wait while the module restarts
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
// Begin by printing the current measurement rate and navigation rate
uint16_t rate = myGNSS.getMeasurementRate(); //Get the measurement rate of this module
Serial.print("Current measurement interval (ms): ");
Serial.println(rate);
rate = myGNSS.getNavigationRate(); //Get the navigation rate of this module
Serial.print("Current navigation ratio (cycles): ");
Serial.println(rate);
// The measurement rate is the elapsed time between GNSS measurements, which defines the rate
// e.g. 100 ms => 10 Hz, 1000 ms => 1 Hz, 10000 ms => 0.1 Hz.
// Let's set the measurement rate (interval) to 5 seconds = 5000 milliseconds
if (myGNSS.setMeasurementRate(5000) == false)
{
Serial.println(F("Could not set the measurement rate. Freezing."));
while (1);
}
// setMeasurementRate will set i2cPollingWait to a quarter of the interval
// Let's override that so we can poll the module more frequently and avoid timeouts
myGNSS.setI2CpollingWait(25); // Set i2cPollingWait to 25ms
// The navigation rate is the ratio between the number of measurements and the number of navigation solutions
// e.g. 5 means five measurements for every navigation solution. Maximum value is 127
// Let's set the navigation rate (ratio) to 12 to produce a solution every minute
if (myGNSS.setNavigationRate(12) == false)
{
Serial.println(F("Could not set the navigation rate. Freezing."));
while (1);
}
// Another trick we can use is to mark the CFG RATE data as stale so we can be sure we read fresh data
myGNSS.packetUBXCFGRATE->moduleQueried.moduleQueried.all = 0; // Mark all of the CFG RATE data as stale
// Read and print the updated measurement rate and navigation rate
rate = myGNSS.getMeasurementRate(); //Get the measurement rate of this module
Serial.print("New measurement interval (ms): ");
Serial.println(rate);
rate = myGNSS.getNavigationRate(); //Get the navigation rate of this module
Serial.print("New navigation ratio (cycles): ");
Serial.println(rate);
lastTime = millis();
}
void loop()
{
// i2cPollingWait will prevent us from thrashing the I2C bus
if (myGNSS.getPVT()) //Check for new Position, Velocity, Time data. getPVT returns true if new data is available.
{
long latitude = myGNSS.getLatitude();
Serial.print(F("Lat: "));
Serial.print(latitude);
long longitude = myGNSS.getLongitude();
Serial.print(F(" Long: "));
Serial.print(longitude);
//Calculate the interval since the last message
Serial.print(F(" Interval: "));
Serial.print(((float)(millis() - lastTime)) / 1000.0, 2);
Serial.print(F("s"));
Serial.println();
lastTime = millis(); //Update lastTime
}
}
+11
View File
@@ -84,6 +84,8 @@ setFileBufferSize KEYWORD2
extractFileBufferData KEYWORD2
fileBufferAvailable KEYWORD2
getMaxFileBufferAvail KEYWORD2
clearFileBuffer KEYWORD2
clearMaxFileBufferAvail KEYWORD2
getPortSettings KEYWORD2
setPortOutput KEYWORD2
@@ -369,6 +371,10 @@ logHNRPVT KEYWORD2
setNavigationFrequency KEYWORD2
getNavigationFrequency KEYWORD2
setMeasurementRate KEYWORD2
getMeasurementRate KEYWORD2
setNavigationRate KEYWORD2
getNavigationRate KEYWORD2
getGeometricDOP KEYWORD2
getPositionDOP KEYWORD2
@@ -391,8 +397,11 @@ getMinute KEYWORD2
getSecond KEYWORD2
getMillisecond KEYWORD2
getNanosecond KEYWORD2
getUnixEpoch KEYWORD2
getDateValid KEYWORD2
getTimeValid KEYWORD2
getConfirmedDate KEYWORD2
getConfirmedTime KEYWORD2
getFixType KEYWORD2
getGnssFixOk KEYWORD2
getDiffSoln KEYWORD2
@@ -602,3 +611,5 @@ SFE_UBLOX_GNSS_ID_BEIDOU LITERAL1
SFE_UBLOX_GNSS_ID_IMES LITERAL1
SFE_UBLOX_GNSS_ID_QZSS LITERAL1
SFE_UBLOX_GNSS_ID_GLONASS LITERAL1
DAYS_SINCE_MONTH LITERAL1
+1 -1
View File
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library
version=2.0.3
version=2.0.4
author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/>
+155 -1
View File
@@ -3055,6 +3055,20 @@ uint16_t SFE_UBLOX_GNSS::getMaxFileBufferAvail(void)
return (fileBufferMaxAvail);
}
// Clear the file buffer - discard all contents
void SFE_UBLOX_GNSS::clearFileBuffer(void)
{
if (fileBufferSize == 0) // Bail if the user has not called setFileBufferSize (probably redundant)
return;
fileBufferTail = fileBufferHead;
}
// Reset fileBufferMaxAvail
void SFE_UBLOX_GNSS::clearMaxFileBufferAvail(void)
{
fileBufferMaxAvail = 0;
}
// PRIVATE: Create the file buffer. Called by .begin
boolean SFE_UBLOX_GNSS::createFileBuffer(void)
{
@@ -8569,7 +8583,7 @@ boolean SFE_UBLOX_GNSS::setNavigationFrequency(uint8_t navFreq, uint16_t maxWait
//Adjust the I2C polling timeout based on update rate
i2cPollingWait = 1000 / (((int)navFreq) * 4); //This is the number of ms to wait between checks for new I2C data
//Query the module for the latest lat/long
//Query the module
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_RATE;
packetCfg.len = 0;
@@ -8606,6 +8620,79 @@ uint8_t SFE_UBLOX_GNSS::getNavigationFrequency(uint16_t maxWait)
return (measurementRate);
}
//Set the elapsed time between GNSS measurements in milliseconds, which defines the rate
boolean SFE_UBLOX_GNSS::setMeasurementRate(uint16_t rate, uint16_t maxWait)
{
//Adjust the I2C polling timeout based on update rate
i2cPollingWait = rate / 4; //This is the number of ms to wait between checks for new I2C data
//Query the module
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_RATE;
packetCfg.len = 0;
packetCfg.startingSpot = 0;
//This will load the payloadCfg array with current settings of the given register
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return (false); //If command send fails then bail
//payloadCfg is now loaded with current bytes. Change only the ones we need to
payloadCfg[0] = rate & 0xFF; //measRate LSB
payloadCfg[1] = rate >> 8; //measRate MSB
return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
}
//Return the elapsed time between GNSS measurements in milliseconds, which defines the rate
uint16_t SFE_UBLOX_GNSS::getMeasurementRate(uint16_t maxWait)
{
if (packetUBXCFGRATE == NULL) initPacketUBXCFGRATE(); //Check that RAM has been allocated for the RATE data
if (packetUBXCFGRATE == NULL) //Bail if the RAM allocation failed
return 0;
if (packetUBXCFGRATE->moduleQueried.moduleQueried.bits.measRate == false)
getNavigationFrequencyInternal(maxWait);
packetUBXCFGRATE->moduleQueried.moduleQueried.bits.measRate = false; //Since we are about to give this to user, mark this data as stale
packetUBXCFGRATE->moduleQueried.moduleQueried.bits.all = false;
return (packetUBXCFGRATE->data.measRate);
}
//Set the ratio between the number of measurements and the number of navigation solutions. Unit is cycles. Max is 127.
boolean SFE_UBLOX_GNSS::setNavigationRate(uint16_t rate, uint16_t maxWait)
{
//Query the module
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_RATE;
packetCfg.len = 0;
packetCfg.startingSpot = 0;
//This will load the payloadCfg array with current settings of the given register
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return (false); //If command send fails then bail
//payloadCfg is now loaded with current bytes. Change only the ones we need to
payloadCfg[2] = rate & 0xFF; //navRate LSB
payloadCfg[3] = rate >> 8; //navRate MSB
return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
}
//Return the ratio between the number of measurements and the number of navigation solutions. Unit is cycles
uint16_t SFE_UBLOX_GNSS::getNavigationRate(uint16_t maxWait)
{
if (packetUBXCFGRATE == NULL) initPacketUBXCFGRATE(); //Check that RAM has been allocated for the RATE data
if (packetUBXCFGRATE == NULL) //Bail if the RAM allocation failed
return 0;
if (packetUBXCFGRATE->moduleQueried.moduleQueried.bits.navRate == false)
getNavigationFrequencyInternal(maxWait);
packetUBXCFGRATE->moduleQueried.moduleQueried.bits.navRate = false; //Since we are about to give this to user, mark this data as stale
packetUBXCFGRATE->moduleQueried.moduleQueried.bits.all = false;
return (packetUBXCFGRATE->data.navRate);
}
// ***** DOP Helper Functions
uint16_t SFE_UBLOX_GNSS::getGeometricDOP(uint16_t maxWait)
@@ -8867,6 +8954,45 @@ int32_t SFE_UBLOX_GNSS::getNanosecond(uint16_t maxWait)
return (packetUBXNAVPVT->data.nano);
}
//Get the current Unix epoch - includes microseconds
uint32_t SFE_UBLOX_GNSS::getUnixEpoch(uint32_t& microsecond, uint16_t maxWait)
{
if (packetUBXNAVPVT == NULL) initPacketUBXNAVPVT(); //Check that RAM has been allocated for the PVT data
if (packetUBXNAVPVT == NULL) //Bail if the RAM allocation failed
return 0;
if (packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedTime == false)
getPVT(maxWait);
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedTime = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.year = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.month = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.day = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.hour = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.min = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.sec = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.nano = false;
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false;
uint32_t t = 0;
if((bool)packetUBXNAVPVT->data.flags2.bits.confirmedTime)
{
// assemble time elements into time_t - credits to Thomas Roell @ https://github.com/GrumpyOldPizza
t = (uint32_t)(((((((packetUBXNAVPVT->data.year - 1970) * 365) + (((packetUBXNAVPVT->data.year - 1970) + 3) / 4)) +
DAYS_SINCE_MONTH[(packetUBXNAVPVT->data.year - 1970) & 3][packetUBXNAVPVT->data.month] +
(packetUBXNAVPVT->data.day - 1)) * 24 +
packetUBXNAVPVT->data.hour) * 60 +
packetUBXNAVPVT->data.min) * 60 +
packetUBXNAVPVT->data.sec);
int32_t us = packetUBXNAVPVT->data.nano / 1000;
microsecond = (uint32_t)us;
// adjust t if nano is negative
if(us < 0) {
microsecond = (uint32_t)(us + 1000000);
t--;
}
}
return t;
}
//Get the current date validity
bool SFE_UBLOX_GNSS::getDateValid(uint16_t maxWait)
{
@@ -8895,6 +9021,34 @@ bool SFE_UBLOX_GNSS::getTimeValid(uint16_t maxWait)
return ((bool)packetUBXNAVPVT->data.valid.bits.validTime);
}
//Get the confirmed date validity
bool SFE_UBLOX_GNSS:: getConfirmedDate(uint16_t maxWait)
{
if (packetUBXNAVPVT == NULL) initPacketUBXNAVPVT(); //Check that RAM has been allocated for the PVT data
if (packetUBXNAVPVT == NULL) //Bail if the RAM allocation failed
return (false);
if (packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedDate == false)
getPVT(maxWait);
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedDate = false; //Since we are about to give this to user, mark this data as stale
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false;
return ((bool)packetUBXNAVPVT->data.flags2.bits.confirmedDate);
}
//Get the confirmed time validity
bool SFE_UBLOX_GNSS:: getConfirmedTime(uint16_t maxWait)
{
if (packetUBXNAVPVT == NULL) initPacketUBXNAVPVT(); //Check that RAM has been allocated for the PVT data
if (packetUBXNAVPVT == NULL) //Bail if the RAM allocation failed
return (false);
if (packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedTime == false)
getPVT(maxWait);
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.confirmedTime = false; //Since we are about to give this to user, mark this data as stale
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false;
return ((bool)packetUBXNAVPVT->data.flags2.bits.confirmedTime);
}
//Get the current fix type
//0=no fix, 1=dead reckoning, 2=2D, 3=3D, 4=GNSS, 5=Time fix
uint8_t SFE_UBLOX_GNSS::getFixType(uint16_t maxWait)
+18 -1
View File
@@ -454,6 +454,14 @@ typedef struct
bool moduleQueried;
} moduleSWVersion_t;
const uint16_t DAYS_SINCE_MONTH[4][16] =
{
{ 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 335, 335, 335 },
{ 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 334, 334, 334 },
{ 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 334, 334, 334 },
{ 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 334, 334, 334 },
};
class SFE_UBLOX_GNSS
{
public:
@@ -559,6 +567,8 @@ public:
uint16_t extractFileBufferData(uint8_t *destination, uint16_t numBytes); // Extract numBytes of data from the file buffer. Copy it to destination. It is the user's responsibility to ensure destination is large enough.
uint16_t fileBufferAvailable(void); // Returns the number of bytes available in file buffer which are waiting to be read
uint16_t getMaxFileBufferAvail(void); // Returns the maximum number of bytes which the file buffer has contained. Handy for checking the buffer is large enough to handle all the incoming data.
void clearFileBuffer(void); // Empty the file buffer - discard all contents
void clearMaxFileBufferAvail(void); // Reset fileBufferMaxAvail
// Specific commands
@@ -896,6 +906,10 @@ public:
boolean setNavigationFrequency(uint8_t navFreq, uint16_t maxWait = defaultMaxWait); //Set the number of nav solutions sent per second
uint8_t getNavigationFrequency(uint16_t maxWait = defaultMaxWait); //Get the number of nav solutions sent per second currently being output by module
boolean setMeasurementRate(uint16_t rate, uint16_t maxWait = defaultMaxWait); //Set the elapsed time between GNSS measurements in milliseconds, which defines the rate
uint16_t getMeasurementRate(uint16_t maxWait = defaultMaxWait); //Return the elapsed time between GNSS measurements in milliseconds
boolean setNavigationRate(uint16_t rate, uint16_t maxWait = defaultMaxWait); //Set the ratio between the number of measurements and the number of navigation solutions. Unit is cycles. Max is 127
uint16_t getNavigationRate(uint16_t maxWait = defaultMaxWait); //Return the ratio between the number of measurements and the number of navigation solutions. Unit is cycles
// Helper functions for DOP
@@ -924,9 +938,12 @@ public:
uint8_t getSecond(uint16_t maxWait = defaultMaxWait);
uint16_t getMillisecond(uint16_t maxWait = defaultMaxWait);
int32_t getNanosecond(uint16_t maxWait = defaultMaxWait);
uint32_t getUnixEpoch(uint32_t& microsecond, uint16_t maxWait = defaultMaxWait);
bool getDateValid(uint16_t maxWait = defaultMaxWait);
bool getTimeValid(uint16_t maxWait = defaultMaxWait);
bool getConfirmedDate(uint16_t maxWait = defaultMaxWait);
bool getConfirmedTime(uint16_t maxWait = defaultMaxWait);
uint8_t getFixType(uint16_t maxWait = defaultMaxWait); //Returns the type of fix: 0=no, 3=3D, 4=GNSS+Deadreckoning
@@ -1164,7 +1181,7 @@ private:
//Limit checking of new data to every X ms
//If we are expecting an update every X Hz then we should check every half that amount of time
//Otherwise we may block ourselves from seeing new data
uint8_t i2cPollingWait = 100; //Default to 100ms. Adjusted when user calls setNavigationFrequency() or setHNRNavigationRate()
uint8_t i2cPollingWait = 100; //Default to 100ms. Adjusted when user calls setNavigationFrequency() or setHNRNavigationRate() or setMeasurementRate()
unsigned long lastCheck = 0;
+1 -1
View File
@@ -1052,7 +1052,7 @@ typedef struct
uint8_t rcvTow[8]; // Measurement time of week in receiver local time [64-bit float]
uint16_t week; // GPS week number
int8_t leapS; // GPS leap seconds
uint8_t numMeas; // Numnber of measurements to follow
uint8_t numMeas; // Number of measurements to follow
union
{
uint8_t all;