From 318e76383e96d6676bbb57294c25e665c0d4a31f Mon Sep 17 00:00:00 2001 From: PaulZC Date: Tue, 11 Jan 2022 15:10:55 +0000 Subject: [PATCH] Step_6.6 --- src/SparkFun_u-blox_GNSS_Arduino_Library.cpp | 54 ++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index 6088ab0..9a3f29d 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -12773,6 +12773,60 @@ uint32_t SFE_UBLOX_GNSS::getVerticalAccuracy(uint16_t maxWait) return (packetUBXNAVHPPOSLLH->data.vAcc); } +// ***** PVAT Helper Functions + +int32_t SFE_UBLOX_GNSS::getVehicleRoll(uint16_t maxWait) +{ + if (packetUBXNAVPVAT == NULL) initPacketUBXNAVPVAT(); //Check that RAM has been allocated for the PVAT data + if (packetUBXNAVPVAT == NULL) //Bail if the RAM allocation failed + return 0; + + if (packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehRoll == false) + getNAVPVAT(maxWait); + packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehRoll = false; //Since we are about to give this to user, mark this data as stale + packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false; + return (packetUBXNAVPVAT->data.vehRoll); +} + +int32_t SFE_UBLOX_GNSS::getVehiclePitch(uint16_t maxWait) +{ + if (packetUBXNAVPVAT == NULL) initPacketUBXNAVPVAT(); //Check that RAM has been allocated for the PVAT data + if (packetUBXNAVPVAT == NULL) //Bail if the RAM allocation failed + return 0; + + if (packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehPitch == false) + getNAVPVAT(maxWait); + packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehPitch = false; //Since we are about to give this to user, mark this data as stale + packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false; + return (packetUBXNAVPVAT->data.vehPitch); +} + +int32_t SFE_UBLOX_GNSS::getVehicleHeading(uint16_t maxWait) +{ + if (packetUBXNAVPVAT == NULL) initPacketUBXNAVPVAT(); //Check that RAM has been allocated for the PVAT data + if (packetUBXNAVPVAT == NULL) //Bail if the RAM allocation failed + return 0; + + if (packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehHeading == false) + getNAVPVAT(maxWait); + packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.vehHeading = false; //Since we are about to give this to user, mark this data as stale + packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false; + return (packetUBXNAVPVAT->data.vehHeading); +} + +int32_t SFE_UBLOX_GNSS::getMotionHeading(uint16_t maxWait) +{ + if (packetUBXNAVPVAT == NULL) initPacketUBXNAVPVAT(); //Check that RAM has been allocated for the PVAT data + if (packetUBXNAVPVAT == NULL) //Bail if the RAM allocation failed + return 0; + + if (packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.motHeading == false) + getNAVPVAT(maxWait); + packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.motHeading = false; //Since we are about to give this to user, mark this data as stale + packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false; + return (packetUBXNAVPVAT->data.motHeading); +} + // ***** SVIN Helper Functions bool SFE_UBLOX_GNSS::getSurveyInActive(uint16_t maxWait)