Updating examples: change class name & update header file

This commit is contained in:
PaulZC
2021-01-09 08:18:31 +00:00
parent 2d0307f3b3
commit 627fc27700
62 changed files with 856 additions and 856 deletions
@@ -24,7 +24,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -35,22 +35,22 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(Serial);
//myGNSS.enableDebugging(Serial);
if (myGPS.begin(Wire) == false) //Connect to the u-blox module using Wire port
if (myGNSS.begin(Wire) == 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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.setNavigationFrequency(20); //Set output to 20 times a second
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.setNavigationFrequency(20); //Set output to 20 times a second
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
Serial.print("Current update rate: ");
Serial.println(rate);
//myGPS.saveConfiguration(); //Save the current settings to flash and BBR
//myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
}
void loop()
@@ -79,15 +79,15 @@ void loop()
// The high resolution altitudes can be converted into standard 32-bit float
// First, let's collect the position data
int32_t latitude = myGPS.getHighResLatitude();
int8_t latitudeHp = myGPS.getHighResLatitudeHp();
int32_t longitude = myGPS.getHighResLongitude();
int8_t longitudeHp = myGPS.getHighResLongitudeHp();
int32_t ellipsoid = myGPS.getElipsoid();
int8_t ellipsoidHp = myGPS.getElipsoidHp();
int32_t msl = myGPS.getMeanSeaLevel();
int8_t mslHp = myGPS.getMeanSeaLevelHp();
uint32_t accuracy = myGPS.getHorizontalAccuracy();
int32_t latitude = myGNSS.getHighResLatitude();
int8_t latitudeHp = myGNSS.getHighResLatitudeHp();
int32_t longitude = myGNSS.getHighResLongitude();
int8_t longitudeHp = myGNSS.getHighResLongitudeHp();
int32_t ellipsoid = myGNSS.getElipsoid();
int8_t ellipsoidHp = myGNSS.getElipsoidHp();
int32_t msl = myGNSS.getMeanSeaLevel();
int8_t mslHp = myGNSS.getMeanSeaLevelHp();
uint32_t accuracy = myGNSS.getHorizontalAccuracy();
// Defines storage for the lat and lon units integer and fractional parts
int32_t lat_int; // Integer part of the latitude in degrees
@@ -30,7 +30,7 @@
//#define myWire Wire1 // Uncomment this line if you are using the extra SCL1/SDA1 pins (D17 and D16) on the Thing Plus
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -41,9 +41,9 @@ void setup()
myWire.begin();
//myGPS.enableDebugging(Serial); // Uncomment this line to enable debug messages
//myGNSS.enableDebugging(Serial); // Uncomment this line to enable debug messages
if (myGPS.begin(myWire) == false) //Connect to the u-blox module using Wire port
if (myGNSS.begin(myWire) == 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)
@@ -57,15 +57,15 @@ void setup()
Serial.println(F("The latitude and longitude will be inaccurate."));
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
//myGPS.setNavigationFrequency(20); //Set output to 20 times a second
//myGNSS.setNavigationFrequency(20); //Set output to 20 times a second
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
Serial.print("Current update rate: ");
Serial.println(rate);
//myGPS.saveConfiguration(); //Save the current settings to flash and BBR
//myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
}
void loop()
@@ -87,15 +87,15 @@ void loop()
// getHorizontalAccuracy: returns the horizontal accuracy estimate from HPPOSLLH as an uint32_t in mm * 10^-1
// First, let's collect the position data
int32_t latitude = myGPS.getHighResLatitude();
int8_t latitudeHp = myGPS.getHighResLatitudeHp();
int32_t longitude = myGPS.getHighResLongitude();
int8_t longitudeHp = myGPS.getHighResLongitudeHp();
int32_t ellipsoid = myGPS.getElipsoid();
int8_t ellipsoidHp = myGPS.getElipsoidHp();
int32_t msl = myGPS.getMeanSeaLevel();
int8_t mslHp = myGPS.getMeanSeaLevelHp();
uint32_t accuracy = myGPS.getHorizontalAccuracy();
int32_t latitude = myGNSS.getHighResLatitude();
int8_t latitudeHp = myGNSS.getHighResLatitudeHp();
int32_t longitude = myGNSS.getHighResLongitude();
int8_t longitudeHp = myGNSS.getHighResLongitudeHp();
int32_t ellipsoid = myGNSS.getElipsoid();
int8_t ellipsoidHp = myGNSS.getElipsoidHp();
int32_t msl = myGNSS.getMeanSeaLevel();
int8_t mslHp = myGNSS.getMeanSeaLevelHp();
uint32_t accuracy = myGNSS.getHorizontalAccuracy();
// Defines storage for the lat and lon as double
double d_lat; // latitude
@@ -25,7 +25,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -36,36 +36,36 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
;
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
boolean success = true;
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
//Units are cm so 1234 = 12.34m
//success &= myGPS.setStaticPosition(-128020831, -471680385, 408666581);
//success &= myGNSS.setStaticPosition(-128020831, -471680385, 408666581);
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
success &= myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
success &= myGNSS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
//We can also set via lat/long
//40.09029751,-105.18507900,1560.238
//success &= myGPS.setStaticPosition(400902975, -1051850790, 156024, true); //True at end enables lat/long input
//success &= myGPS.setStaticPosition(400902975, 10, -1051850790, 0, 156023, 80, true);
//success &= myGNSS.setStaticPosition(400902975, -1051850790, 156024, true); //True at end enables lat/long input
//success &= myGNSS.setStaticPosition(400902975, 10, -1051850790, 0, 156023, 80, true);
if (!success) Serial.println(F("At least one call to setStaticPosition failed!"));
//Now let's use getVals to read back the data
//long ecefX = myGPS.getVal32(0x40030003);
//long ecefX = myGNSS.getVal32(0x40030003);
//Serial.print("ecefX: ");
//Serial.println(ecefX);
@@ -31,8 +31,8 @@
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -42,72 +42,72 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
//myGPS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
//myGNSS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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
//myGPS.factoryDefault(); delay(5000);
//myGNSS.factoryDefault(); delay(5000);
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
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
myGPS.setNavigationFrequency(1); //Produce one solution per second
myGNSS.setNavigationFrequency(1); //Produce one solution per second
// The acid test: all four of these combinations should work seamlessly :-)
//myGPS.setAutoPVT(false); // Library will poll each reading
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
//myGNSS.setAutoPVT(false); // Library will poll each reading
//myGNSS.setAutoHPPOSLLH(false); // Library will poll each reading
//myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
//myGNSS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
//myGNSS.setAutoHPPOSLLH(false); // Library will poll each reading
//myGPS.setAutoPVT(false); // Library will poll each reading
//myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
//myGNSS.setAutoPVT(false); // Library will poll each reading
//myGNSS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
myGNSS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
myGNSS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
}
void loop()
{
// Calling getHPPOSLLH returns true if there actually is a fresh navigation solution available.
// Calling getPVT returns true if there actually is a fresh navigation solution available.
if ((myGPS.getHPPOSLLH()) || (myGPS.getPVT()))
if ((myGNSS.getHPPOSLLH()) || (myGNSS.getPVT()))
{
Serial.println();
long highResLatitude = myGPS.getHighResLatitude();
long highResLatitude = myGNSS.getHighResLatitude();
Serial.print(F("Hi Res Lat: "));
Serial.print(highResLatitude);
int highResLatitudeHp = myGPS.getHighResLatitudeHp();
int highResLatitudeHp = myGNSS.getHighResLatitudeHp();
Serial.print(F(" "));
Serial.print(highResLatitudeHp);
long highResLongitude = myGPS.getHighResLongitude();
long highResLongitude = myGNSS.getHighResLongitude();
Serial.print(F(" Hi Res Long: "));
Serial.print(highResLongitude);
int highResLongitudeHp = myGPS.getHighResLongitudeHp();
int highResLongitudeHp = myGNSS.getHighResLongitudeHp();
Serial.print(F(" "));
Serial.print(highResLongitudeHp);
unsigned long horizAccuracy = myGPS.getHorizontalAccuracy();
unsigned long horizAccuracy = myGNSS.getHorizontalAccuracy();
Serial.print(F(" Horiz accuracy: "));
Serial.print(horizAccuracy);
long latitude = myGPS.getLatitude();
long latitude = myGNSS.getLatitude();
Serial.print(F(" Lat: "));
Serial.print(latitude);
long longitude = myGPS.getLongitude();
long longitude = myGNSS.getLongitude();
Serial.print(F(" Long: "));
Serial.println(longitude);
}
@@ -31,8 +31,8 @@
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
// Callback: printHPdata will be called when new NAV HPPOSLLH data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_HPPOSLLH_data_t
@@ -118,32 +118,32 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
//myGPS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
//myGNSS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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
//myGPS.factoryDefault(); delay(5000);
//myGNSS.factoryDefault(); delay(5000);
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
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
myGPS.setNavigationFrequency(2); //Produce two solutions per second
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
myGPS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
myGNSS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
}
void loop()
{
myGPS.checkUblox(); // Check for the arrival of new data and process it. You could set up a timer interrupt to do this for you.
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
myGNSS.checkUblox(); // Check for the arrival of new data and process it. You could set up a timer interrupt to do this for you.
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
Serial.print(".");
delay(50);
@@ -37,7 +37,7 @@ WiFiClient client;
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
//Basic Connection settings to RTK2Go NTRIP Caster - See secrets for mount specific credentials
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -62,9 +62,9 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
@@ -81,19 +81,19 @@ void setup()
Serial.print("\nWiFi connected with IP: ");
Serial.println(WiFi.localIP());
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); //UBX+RTCM3 is not a valid option so we enable all three.
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); //UBX+RTCM3 is not a valid option so we enable all three.
myGPS.setNavigationFrequency(1); //Set output in Hz. RTCM rarely benefits from >1Hz.
myGNSS.setNavigationFrequency(1); //Set output in Hz. RTCM rarely benefits from >1Hz.
//Disable all NMEA sentences
bool response = true;
response &= myGPS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_GST, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_I2C);
response &= myGPS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GST, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_I2C);
response &= myGNSS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_I2C);
if (response == false)
{
@@ -104,12 +104,12 @@ void setup()
Serial.println(F("NMEA disabled"));
//Enable necessary RTCM sentences
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through UART2, message every second
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through UART2, message every second
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
if (response == false)
{
@@ -125,7 +125,7 @@ void setup()
//Note: If you leave these coordinates in place and setup your antenna *not* at SparkFun, your receiver
//will be very confused and fail to generate correction data because, well, you aren't at SparkFun...
//See this tutorial on getting PPP coordinates: https://learn.sparkfun.com/tutorials/how-to-build-a-diy-gnss-reference-station/all
response &= myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
response &= myGNSS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
if (response == false)
{
Serial.println(F("Failed to enter static position. Freezing..."));
@@ -135,9 +135,9 @@ void setup()
Serial.println(F("Static position set"));
//You could instead do a survey-in but it takes much longer to start generating RTCM data. See Example4_BaseWithLCD
//myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
//myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
if (myGPS.saveConfiguration() == false) //Save the current settings to flash and BBR
if (myGNSS.saveConfiguration() == false) //Save the current settings to flash and BBR
Serial.println(F("Module failed to save."));
Serial.println(F("Module configuration complete"));
@@ -228,7 +228,7 @@ void beginServing()
{
if (Serial.available()) break;
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
//Close socket if we don't have new data for 10s
//RTK2Go will ban your IP address if you abuse it. See http://www.rtk2go.com/how-to-get-your-ip-banned/
@@ -265,7 +265,7 @@ void beginServing()
//This function gets called from the SparkFun u-blox Arduino Library.
//As each RTCM byte comes in you can specify what to do with it
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
{
if (client.connected() == true)
{
@@ -24,7 +24,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -36,14 +36,14 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
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
}
void loop()
@@ -54,21 +54,21 @@ void loop()
{
lastTime = millis(); //Update the timer
long latitude = myGPS.getLatitude();
long latitude = myGNSS.getLatitude();
Serial.print(F("Lat: "));
Serial.print(latitude);
long longitude = myGPS.getLongitude();
long longitude = myGNSS.getLongitude();
Serial.print(F(" Long: "));
Serial.print(longitude);
Serial.print(F(" (degrees * 10^-7)"));
long altitude = myGPS.getAltitude();
long altitude = myGNSS.getAltitude();
Serial.print(F(" Alt: "));
Serial.print(altitude);
Serial.print(F(" (mm)"));
long accuracy = myGPS.getPositionAccuracy();
long accuracy = myGNSS.getPositionAccuracy();
Serial.print(F(" 3D Positional Accuracy: "));
Serial.print(accuracy);
Serial.println(F(" (mm)"));
@@ -30,7 +30,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -42,18 +42,18 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
byte response;
response = myGPS.getVal8(UBLOX_CFG_I2C_ADDRESS, VAL_LAYER_RAM); // Get the I2C address (see u-blox_config_keys.h for details)
response = myGNSS.getVal8(UBLOX_CFG_I2C_ADDRESS, VAL_LAYER_RAM); // Get the I2C address (see u-blox_config_keys.h for details)
Serial.print(F("I2C Address: 0x"));
Serial.println(response >> 1, HEX); //We have to shift by 1 to get the common '7-bit' I2C address format
response = myGPS.getVal8(UBLOX_CFG_I2COUTPROT_NMEA, VAL_LAYER_RAM); // Get the flag indicating is NMEA should be output on I2C
response = myGNSS.getVal8(UBLOX_CFG_I2COUTPROT_NMEA, VAL_LAYER_RAM); // Get the flag indicating is NMEA should be output on I2C
Serial.print(F("Output NMEA over I2C port: 0x"));
Serial.print(response, HEX);
}
@@ -27,7 +27,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data to Serial1
@@ -45,33 +45,33 @@ void setup()
Wire.begin();
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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
//myGPS.factoryDefault(); delay(5000);
//myGNSS.factoryDefault(); delay(5000);
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
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
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
Serial.println(F("Press any key to send commands to begin Survey-In"));
while (Serial.available() == 0) ; //Wait for user to press a key
boolean response = true;
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
//Use COM_PORT_UART1 for the above six messages to direct RTCM messages out UART1
//COM_PORT_UART2, COM_PORT_USB, COM_PORT_SPI are also available
//For example: response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_UART1, 10);
//For example: response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_UART1, 10);
if (response == true)
{
@@ -88,7 +88,7 @@ void setup()
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
// You can either read the data from packetUBXNAVSVIN directly
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
if (response == false) // Check if fresh data was received
{
@@ -96,8 +96,8 @@ void setup()
while (1); //Freeze
}
if (myGPS.getSurveyInActive() == true) // Use the helper function
//if (myGPS.packetUBXNAVSVIN->data.active > 0) // Or we could read active directly
if (myGNSS.getSurveyInActive() == true) // Use the helper function
//if (myGNSS.packetUBXNAVSVIN->data.active > 0) // Or we could read active directly
{
Serial.print(F("Survey already in progress."));
}
@@ -105,8 +105,8 @@ void setup()
{
//Start survey
//The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
//response = myGPS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.0m
response = myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
//response = myGNSS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.0m
response = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
if (response == false)
{
Serial.println(F("Survey start failed. Freezing..."));
@@ -118,8 +118,8 @@ void setup()
while(Serial.available()) Serial.read(); //Clear buffer
//Begin waiting for survey to complete
while (myGPS.getSurveyInValid() == false) // Call the helper function
//while (myGPS.packetUBXNAVSVIN->data.valid == 0) // Or we could read valid directly
while (myGNSS.getSurveyInValid() == false) // Call the helper function
//while (myGNSS.packetUBXNAVSVIN->data.valid == 0) // Or we could read valid directly
{
if(Serial.available())
{
@@ -127,7 +127,7 @@ void setup()
if(incoming == 'x')
{
//Stop survey mode
response = myGPS.disableSurveyMode(); //Disable survey
response = myGNSS.disableSurveyMode(); //Disable survey
Serial.println(F("Survey stopped"));
break;
}
@@ -137,21 +137,21 @@ void setup()
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
// You can either read the data from packetUBXNAVSVIN directly
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
if (response == true) // Check if fresh data was received
{
Serial.print(F("Press x to end survey - "));
Serial.print(F("Time elapsed: "));
Serial.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
Serial.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
Serial.print(F(" ("));
Serial.print((String)myGPS.packetUBXNAVSVIN->data.dur); // Read the survey-in duration directly from packetUBXNAVSVIN
Serial.print((String)myGNSS.packetUBXNAVSVIN->data.dur); // Read the survey-in duration directly from packetUBXNAVSVIN
Serial.print(F(") Accuracy: "));
Serial.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
Serial.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
Serial.print(F(" ("));
// Read the mean accuracy directly from packetUBXNAVSVIN and manually convert from mm*0.1 to m
float meanAcc = ((float)myGPS.packetUBXNAVSVIN->data.meanAcc) / 10000.0;
float meanAcc = ((float)myGNSS.packetUBXNAVSVIN->data.meanAcc) / 10000.0;
Serial.print((String)meanAcc);
Serial.println(F(")"));
}
@@ -166,12 +166,12 @@ void setup()
Serial.println(F("Base survey complete! RTCM now broadcasting."));
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
}
void loop()
{
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
delay(250); //Don't pound too hard on the I2C bus
}
@@ -179,7 +179,7 @@ void loop()
//This function gets called from the SparkFun u-blox Arduino Library.
//As each RTCM byte comes in you can specify what to do with it
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
{
#ifdef USE_SERIAL1
//Push the RTCM data to Serial1
@@ -187,7 +187,7 @@ void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
#endif
//Pretty-print the HEX values to Serial
if (myGPS.rtcmFrameCounter % 16 == 0) Serial.println();
if (myGNSS.rtcmFrameCounter % 16 == 0) Serial.println();
Serial.print(F(" "));
if (incoming < 0x10) Serial.print(F("0"));
Serial.print(incoming, HEX);
@@ -32,7 +32,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
#include <SerLCD.h> //Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
SerLCD lcd; // Initialize the library with default I2C address 0x72
@@ -54,8 +54,8 @@ void setup()
lcd.clear();
lcd.print(F("LCD Ready"));
myGPS.begin(Wire);
if (myGPS.isConnected() == false)
myGNSS.begin(Wire);
if (myGNSS.isConnected() == false)
{
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
lcd.setCursor(0, 1);
@@ -69,17 +69,17 @@ void setup()
lcd.setCursor(0, 1);
lcd.print("GNSS Detected");
//myGPS.setI2COutput(COM_TYPE_RTCM3); //Set the I2C port to output RTCM3 sentences (turn off NMEA noise)
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX sentences (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
//myGNSS.setI2COutput(COM_TYPE_RTCM3); //Set the I2C port to output RTCM3 sentences (turn off NMEA noise)
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX sentences (turn off NMEA noise)
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
boolean response = true;
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
if (response == true)
{
Serial.println(F("RTCM messages enabled"));
@@ -96,7 +96,7 @@ void setup()
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
// You can either read the data from packetUBXNAVSVIN directly
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
if (response == false)
{
Serial.println(F("Failed to get Survey In status. Freezing."));
@@ -104,7 +104,7 @@ void setup()
; //Freeze
}
if (myGPS.getSurveyInActive() == true) // Use the helper function
if (myGNSS.getSurveyInActive() == true) // Use the helper function
{
Serial.print(F("Survey already in progress."));
lcd.setCursor(0, 2);
@@ -113,7 +113,7 @@ void setup()
else
{
//Start survey
response = myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
response = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
if (response == false)
{
Serial.println(F("Survey start failed"));
@@ -132,7 +132,7 @@ void setup()
lcd.print(F("Survey in progress"));
//Begin waiting for survey to complete
while (myGPS.getSurveyInValid() == false) // Call the helper function
while (myGNSS.getSurveyInValid() == false) // Call the helper function
{
if (Serial.available())
{
@@ -140,7 +140,7 @@ void setup()
if (incoming == 'x')
{
//Stop survey mode
response = myGPS.disableSurveyMode(); //Disable survey
response = myGNSS.disableSurveyMode(); //Disable survey
Serial.println(F("Survey stopped"));
break;
}
@@ -150,24 +150,24 @@ void setup()
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
// You can either read the data from packetUBXNAVSVIN directly
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
if (response == true)
{
Serial.print(F("Press x to end survey - "));
Serial.print(F("Time elapsed: "));
Serial.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
Serial.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
lcd.setCursor(0, 1);
lcd.print(F("Elapsed: "));
lcd.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
lcd.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
Serial.print(F(" Accuracy: "));
Serial.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
Serial.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
Serial.println();
lcd.setCursor(0, 2);
lcd.print(F("Accuracy: "));
lcd.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
lcd.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
}
else
{
@@ -182,13 +182,13 @@ void setup()
lcd.clear();
lcd.print(F("Transmitting RTCM"));
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
}
void loop()
{
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
//Do anything you want. Call checkUblox() every second. ZED-F9P has TX buffer of 4k bytes.
@@ -198,10 +198,10 @@ void loop()
//This function gets called from the SparkFun u-blox Arduino Library.
//As each RTCM byte comes in you can specify what to do with it
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
{
//Let's just pretty-print the HEX values for now
if (myGPS.rtcmFrameCounter % 16 == 0)
if (myGNSS.rtcmFrameCounter % 16 == 0)
Serial.println();
Serial.print(" ");
if (incoming < 0x10)
@@ -24,7 +24,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data from Serial1 to the module via I2C
@@ -44,19 +44,19 @@ void setup()
Wire.begin();
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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
//myGPS.factoryDefault(); delay(5000);
//myGNSS.factoryDefault(); delay(5000);
#ifdef USE_SERIAL1
Serial.print(F("Enabling UBX and RTCM input on I2C. Result: "));
Serial.print(myGPS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3)); //Enable UBX and RTCM input on I2C
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
Serial.print(myGNSS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3)); //Enable UBX and RTCM input on I2C
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
#endif
}
@@ -66,76 +66,76 @@ void loop()
// Please see u-blox_structs.h for the full definition of UBX_NAV_RELPOSNED_t
// You can either read the data from packetUBXNAVRELPOSNED directly
// or can use the helper functions: getRelPosN/E/D; getRelPosAccN/E/D
if (myGPS.getRELPOSNED() == true)
if (myGNSS.getRELPOSNED() == true)
{
Serial.print("relPosN: ");
Serial.println(myGPS.getRelPosN(), 4); // Use the helper functions to get the rel. pos. as m
Serial.println(myGNSS.getRelPosN(), 4); // Use the helper functions to get the rel. pos. as m
Serial.print("relPosE: ");
Serial.println(myGPS.getRelPosE(), 4);
Serial.println(myGNSS.getRelPosE(), 4);
Serial.print("relPosD: ");
Serial.println(myGPS.getRelPosD(), 4);
Serial.println(myGNSS.getRelPosD(), 4);
Serial.print("relPosLength: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosLength);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosLength);
Serial.print("relPosHeading: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHeading);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHeading);
Serial.print("relPosHPN: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPN);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPN);
Serial.print("relPosHPE: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPE);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPE);
Serial.print("relPosHPD: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPD);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPD);
Serial.print("relPosHPLength: ");
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPLength);
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPLength);
Serial.print("accN: ");
Serial.println(myGPS.getRelPosAccN(), 4); // Use the helper functions to get the rel. pos. accuracy as m
Serial.println(myGNSS.getRelPosAccN(), 4); // Use the helper functions to get the rel. pos. accuracy as m
Serial.print("accE: ");
Serial.println(myGPS.getRelPosAccE(), 4);
Serial.println(myGNSS.getRelPosAccE(), 4);
Serial.print("accD: ");
Serial.println(myGPS.getRelPosAccD(), 4);
Serial.println(myGNSS.getRelPosAccD(), 4);
Serial.print("gnssFixOk: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.gnssFixOK == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.gnssFixOK == true)
Serial.println("x");
else
Serial.println("");
Serial.print("diffSolution: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.diffSoln == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.diffSoln == true)
Serial.println("x");
else
Serial.println("");
Serial.print("relPosValid: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.relPosValid == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.relPosValid == true)
Serial.println("x");
else
Serial.println("");
Serial.print("carrier Solution Type: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 0)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 0)
Serial.println("None");
else if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 1)
else if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 1)
Serial.println("Float");
else if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 2)
else if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 2)
Serial.println("Fixed");
Serial.print("isMoving: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.isMoving == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.isMoving == true)
Serial.println("x");
else
Serial.println("");
Serial.print("refPosMiss: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.refPosMiss == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.refPosMiss == true)
Serial.println("x");
else
Serial.println("");
Serial.print("refObsMiss: ");
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.refObsMiss == true)
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.refObsMiss == true)
Serial.println("x");
else
Serial.println("");
@@ -156,7 +156,7 @@ void loop()
//Serial.print("Pushing ");
//Serial.print(numBytes);
//Serial.println(" bytes via I2C");
myGPS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
myGNSS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
numBytes = 0; // Reset numBytes
}
#endif
@@ -25,7 +25,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -39,17 +39,17 @@ void setup()
Wire.begin();
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
;
}
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
uint8_t currentI2Caddress = myGPS.getVal8(UBLOX_CFG_I2C_ADDRESS);
uint8_t currentI2Caddress = myGNSS.getVal8(UBLOX_CFG_I2C_ADDRESS);
Serial.print("Current I2C address (should be 0x42): 0x");
Serial.println(currentI2Caddress >> 1, HEX); //u-blox module returns a shifted 8-bit address. Make it 7-bit unshifted.
}
@@ -25,7 +25,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
@@ -39,29 +39,29 @@ void setup()
Wire.begin();
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
;
}
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
bool setValueSuccess;
//These key values are hard coded and defined in u-blox_config_keys.h.
//You can obtain them from the ZED-F9P interface description doc
//or from u-center's Messages->CFG->VALSET window. Keys must be 32-bit.
//setValueSuccess = myGPS.setVal(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA
//setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 100ms (10Hz update rate)
setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate)
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 100ms (10Hz update rate)
setValueSuccess = myGNSS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate)
//Below is the original way we enabled the RTCM message on the I2C port. After that, we show how to do the same
//but with setVal().
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
//setValueSuccess = myGPS.setVal(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per second
//Original: myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per second
if (setValueSuccess == true)
{
@@ -24,7 +24,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -35,7 +35,7 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
@@ -45,9 +45,9 @@ void setup()
bool response = true;
//Read the settings from RAM (what the module is running right now, not BBR, Flash, or default)
uint8_t currentUART1Setting_ubx = myGPS.getVal8(UBLOX_CFG_UART1INPROT_UBX);
uint8_t currentUART1Setting_nmea = myGPS.getVal8(UBLOX_CFG_UART1INPROT_NMEA);
uint8_t currentUART1Setting_rtcm3 = myGPS.getVal8(UBLOX_CFG_UART1INPROT_RTCM3X);
uint8_t currentUART1Setting_ubx = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_UBX);
uint8_t currentUART1Setting_nmea = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_NMEA);
uint8_t currentUART1Setting_rtcm3 = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_RTCM3X);
Serial.print("currentUART1Setting_ubx: ");
Serial.println(currentUART1Setting_ubx);
@@ -62,9 +62,9 @@ void setup()
Serial.println("Updating UART1 configuration");
//setVal sets the values for RAM, BBR, and Flash automatically so no .saveConfiguration() is needed
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_UBX, 1); //Enable UBX on UART1 Input
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_NMEA, 1); //Enable NMEA on UART1 Input
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_RTCM3X, 0); //Disable RTCM on UART1 Input
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_UBX, 1); //Enable UBX on UART1 Input
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_NMEA, 1); //Enable NMEA on UART1 Input
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_RTCM3X, 0); //Disable RTCM on UART1 Input
if (response == false)
Serial.println("SetVal failed");
@@ -75,13 +75,13 @@ void setup()
Serial.println("No port change needed");
//Change speed of UART2
uint32_t currentUART2Baud = myGPS.getVal32(UBLOX_CFG_UART2_BAUDRATE);
uint32_t currentUART2Baud = myGNSS.getVal32(UBLOX_CFG_UART2_BAUDRATE);
Serial.print("currentUART2Baud: ");
Serial.println(currentUART2Baud);
if (currentUART2Baud != 57600)
{
response &= myGPS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600);
response &= myGNSS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600);
if (response == false)
Serial.println("SetVal failed");
else
@@ -26,7 +26,7 @@
#include <Wire.h> //Needed for I2C to GNSS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -38,15 +38,15 @@ void setup()
Wire.begin();
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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)
;
}
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
bool setValueSuccess = true;
@@ -57,25 +57,25 @@ void setup()
//U2, I2, E2 and X2 values are 16-bit
//U4, I4, R4, E4, X4 values are 32-bit
setValueSuccess &= myGPS.setVal8(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA (value is 8-bit (L / U1))
//setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 200); //Set measurement rate to 100ms (10Hz update rate) (value is 16-bit (U2))
//setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 200, 1); //Set rate setting in RAM instead of BBR
setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate) (value is 16-bit (U2))
setValueSuccess &= myGNSS.setVal8(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA (value is 8-bit (L / U1))
//setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 200); //Set measurement rate to 100ms (10Hz update rate) (value is 16-bit (U2))
//setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 200, 1); //Set rate setting in RAM instead of BBR
setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate) (value is 16-bit (U2))
//Below is the original way we enabled a single RTCM message on the I2C port. After that, we show how to do the same
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
//Original: myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
//Begin with newCfgValset8/16/32
setValueSuccess &= myGPS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per measurement (value is 8-bit (U1))
//setValueSuccess &= myGPS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1, VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
setValueSuccess &= myGNSS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per measurement (value is 8-bit (U1))
//setValueSuccess &= myGNSS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1, VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
//Add extra keyIDs and values using addCfgValset8/16/32
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1077_I2C, 1); //Set output rate of msg 1077 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1087_I2C, 1); //Set output rate of msg 1087 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1127_I2C, 1); //Set output rate of msg 1127 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1097_I2C, 1); //Set output rate of msg 1097 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1077_I2C, 1); //Set output rate of msg 1077 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1087_I2C, 1); //Set output rate of msg 1087 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1127_I2C, 1); //Set output rate of msg 1127 over the I2C port to once per measurement (value is 8-bit (U1))
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1097_I2C, 1); //Set output rate of msg 1097 over the I2C port to once per measurement (value is 8-bit (U1))
// Add the final value and send the packet using sendCfgValset8/16/32
setValueSuccess &= myGPS.sendCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_I2C, 10); //Set output rate of msg 1230 over the I2C port to once every 10 measurements (value is 8-bit (U1))
setValueSuccess &= myGNSS.sendCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_I2C, 10); //Set output rate of msg 1230 over the I2C port to once every 10 measurements (value is 8-bit (U1))
if (setValueSuccess == true)
{