From 3cede3bfff25510422f5ec62cf9a7ae65d645e2f Mon Sep 17 00:00:00 2001 From: PaulZC Date: Thu, 13 Jan 2022 14:06:52 +0000 Subject: [PATCH] Add setDGNSSConfiguration --- README.md | 12 ++++++++++++ Theory.md | 2 +- keywords.txt | 4 ++++ library.properties | 2 +- src/SparkFun_u-blox_GNSS_Arduino_Library.cpp | 17 +++++++++++++++++ src/SparkFun_u-blox_GNSS_Arduino_Library.h | 8 ++++++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 54be67c..cb8aaca 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,18 @@ If you are using the Dead Reckoning Sensor Fusion or High Dynamic Rate messages, v2.1.0 of the library adds support for u-blox AssistNowTM Assisted GNSS (A-GNSS) which can dramatically reduce the time-to-first-fix. You can find further details in the [AssistNow Examples folder](./examples/AssistNow). +## Automatic support for correction services like RTK2go, Emlid Caster and Skylark (Swift Navigation) + +RTK NTRIP corrections services often require you to send them your location in NMEA GPGGA format. v2.2 of the library makes this simple by providing get functions and automatic callbacks +for both GPGGA and GNGGA messages. You can now instruct your module to output GPGGA (e.g.) every 10 seconds and then push it to the correction server directly from the callback! No more polling, no more parsing! + +v2.2 also includes two new functions useful for correction services: + +* ```setMainTalkerID``` : lets you change the NMEA Talker ID (prefix) from "GN" to "GP" - just in case your correction service really does need GPGGA, not GNGGA +* ```setHighPrecisionMode``` : adds extra decimal places in the GGA messages, increasing the resolution of latitude, longitude and altitude + +Please see the [new examples](./examples/Automatic_NMEA) for more details. + ## Memory Usage The u-blox GNSS library has grown considerably over the years and v2.0.8 came very close to completely filling the program memory on platforms like the ATmega328 (Arduino Uno). diff --git a/Theory.md b/Theory.md index 3cb9ef7..b9bf834 100644 --- a/Theory.md +++ b/Theory.md @@ -49,12 +49,12 @@ In v2.0, the full list of messages which can be processed and logged automatical - UBX-NAV-DOP (0x01 0x04): Dilution of precision - UBX-NAV-ATT (0x01 0x05): Attitude solution (**only with ADR or UDR products**) - UBX-NAV-PVT (0x01 0x07): Navigation position velocity time solution -- UBX-NAV-PVAT (0x01 0x17): Navigation position velocity attitude time solution (**only with ADR or UDR products**) - UBX-NAV-ODO (0x01 0x09): Odometer solution - UBX-NAV-VELECEF (0x01 0x11): Velocity solution in ECEF - UBX-NAV-VELNED (0x01 0x12): Velocity solution in NED frame - UBX-NAV-HPPOSECEF (0x01 0x13): High precision position solution in ECEF - UBX-NAV-HPPOSLLH (0x01 0x14): High precision geodetic position solution +- UBX-NAV-PVAT (0x01 0x17): Navigation position velocity attitude time solution (**only with ADR or UDR products**) - UBX-NAV-CLOCK (0x01 0x22): Clock solution - UBX-NAV-SVIN (0x01 0x3B): Survey-in data (**only with High Precision GNSS products**) - UBX-NAV-RELPOSNED (0x01 0x3C): Relative positioning information in NED frame (**only with High Precision GNSS products**) diff --git a/keywords.txt b/keywords.txt index f884576..b40d37e 100644 --- a/keywords.txt +++ b/keywords.txt @@ -140,6 +140,7 @@ setSurveyMode KEYWORD2 enableSurveyMode KEYWORD2 disableSurveyMode KEYWORD2 setStaticPosition KEYWORD2 +setDGNSSConfiguration KEYWORD2 getProtocolVersionHigh KEYWORD2 getProtocolVersionLow KEYWORD2 @@ -761,3 +762,6 @@ SFE_UBLOX_MAIN_TALKER_ID_GN LITERAL1 SFE_UBLOX_MAIN_TALKER_ID_GA LITERAL1 SFE_UBLOX_MAIN_TALKER_ID_GB LITERAL1 SFE_UBLOX_MAIN_TALKER_ID_GQ LITERAL1 + +SFE_UBLOX_DGNSS_MODE_FLOAT LITERAL1 +SFE_UBLOX_DGNSS_MODE_FIXED LITERAL1 diff --git a/library.properties b/library.properties index c3d47aa..efe625a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun u-blox GNSS Arduino Library -version=2.1.5 +version=2.2.0 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=Library for I2C and Serial Communication with u-blox GNSS modules

diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index 43e1665..ac25f36 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -6235,6 +6235,23 @@ bool SFE_UBLOX_GNSS::setStaticPosition(int32_t ecefXOrLat, int32_t ecefYOrLon, i return (setStaticPosition(ecefXOrLat, 0, ecefYOrLon, 0, ecefZOrAlt, 0, latlong, maxWait)); } +// Set the DGNSS differential mode +bool SFE_UBLOX_GNSS::setDGNSSConfiguration(sfe_ublox_dgnss_mode_e dgnssMode, uint16_t maxWait) +{ + packetCfg.cls = UBX_CLASS_CFG; + packetCfg.id = UBX_CFG_DGNSS; + packetCfg.len = 4; + packetCfg.startingSpot = 0; + + payloadCfg[0] = (uint8_t)dgnssMode; + payloadCfg[1] = 0; // reserved0 + payloadCfg[2] = 0; + payloadCfg[3] = 0; + + return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK +} + + // Module Protocol Version //Get the current protocol version of the u-blox module we're communicating with diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.h b/src/SparkFun_u-blox_GNSS_Arduino_Library.h index 77946ce..71b1e1b 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.h +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.h @@ -534,6 +534,13 @@ enum sfe_ublox_talker_ids_e SFE_UBLOX_MAIN_TALKER_ID_GQ }; +// The DGNSS differential mode +enum sfe_ublox_dgnss_mode_e +{ + SFE_UBLOX_DGNSS_MODE_FLOAT = 2, // No attempts are made to fix ambiguities + SFE_UBLOX_DGNSS_MODE_FIXED // Ambiguities are fixed whenever possible +}; + //-=-=-=-=- #ifndef MAX_PAYLOAD_SIZE @@ -829,6 +836,7 @@ public: // For Lat/Lon/Alt the units are: degrees^-7, degrees^-9, degrees^-7, degrees^-9, cm, 0.1mm bool setStaticPosition(int32_t ecefXOrLat, int8_t ecefXOrLatHP, int32_t ecefYOrLon, int8_t ecefYOrLonHP, int32_t ecefZOrAlt, int8_t ecefZOrAltHP, bool latLong = false, uint16_t maxWait = 250); bool setStaticPosition(int32_t ecefXOrLat, int32_t ecefYOrLon, int32_t ecefZOrAlt, bool latLong = false, uint16_t maxWait = 250); + bool setDGNSSConfiguration(sfe_ublox_dgnss_mode_e dgnssMode = SFE_UBLOX_DGNSS_MODE_FIXED, uint16_t maxWait = defaultMaxWait); // Set the DGNSS differential mode //Read the module's protocol version uint8_t getProtocolVersionHigh(uint16_t maxWait = defaultMaxWait); //Returns the PROTVER XX.00 from UBX-MON-VER register