Add setSurveyModeFull, enableSurveyModeFull, getSurveyInObservationTimeFull. See #117

This commit is contained in:
PaulZC
2022-02-28 08:32:55 +00:00
parent f372324f6c
commit 1b7eec1fc4
4 changed files with 42 additions and 23 deletions
@@ -107,6 +107,7 @@ void setup()
//The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info. //The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
//response = myGNSS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.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 response = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
//response = myGNSS.enableSurveyModeFull(86400, 2.000); //Enable Survey in, 24 hours, 2.0m
if (response == false) if (response == false)
{ {
Serial.println(F("Survey start failed. Freezing...")); Serial.println(F("Survey start failed. Freezing..."));
@@ -136,14 +137,14 @@ void setup()
// From v2.0, the data from getSurveyStatus (UBX-NAV-SVIN) is returned in UBX_NAV_SVIN_t packetUBXNAVSVIN // From v2.0, the data from getSurveyStatus (UBX-NAV-SVIN) is returned in UBX_NAV_SVIN_t packetUBXNAVSVIN
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t // Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
// You can either read the data from packetUBXNAVSVIN directly // You can either read the data from packetUBXNAVSVIN directly
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy // or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; getSurveyInObservationTimeFull; and getSurveyInMeanAccuracy
response = myGNSS.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 if (response == true) // Check if fresh data was received
{ {
Serial.print(F("Press x to end survey - ")); Serial.print(F("Press x to end survey - "));
Serial.print(F("Time elapsed: ")); Serial.print(F("Time elapsed: "));
Serial.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function Serial.print((String)myGNSS.getSurveyInObservationTimeFull()); // Call the helper function
Serial.print(F(" (")); Serial.print(F(" ("));
Serial.print((String)myGNSS.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
+3
View File
@@ -145,7 +145,9 @@ disableRTCMmessage KEYWORD2
getSurveyMode KEYWORD2 getSurveyMode KEYWORD2
setSurveyMode KEYWORD2 setSurveyMode KEYWORD2
setSurveyModeFull KEYWORD2
enableSurveyMode KEYWORD2 enableSurveyMode KEYWORD2
enableSurveyModeFull KEYWORD2
disableSurveyMode KEYWORD2 disableSurveyMode KEYWORD2
setStaticPosition KEYWORD2 setStaticPosition KEYWORD2
setDGNSSConfiguration KEYWORD2 setDGNSSConfiguration KEYWORD2
@@ -575,6 +577,7 @@ getMotionHeading KEYWORD2
getSurveyInActive KEYWORD2 getSurveyInActive KEYWORD2
getSurveyInValid KEYWORD2 getSurveyInValid KEYWORD2
getSurveyInObservationTime KEYWORD2 getSurveyInObservationTime KEYWORD2
getSurveyInObservationTimeFull KEYWORD2
getSurveyInMeanAccuracy KEYWORD2 getSurveyInMeanAccuracy KEYWORD2
getRelPosN KEYWORD2 getRelPosN KEYWORD2
+24 -12
View File
@@ -6661,6 +6661,10 @@ bool SFE_UBLOX_GNSS::getSurveyMode(uint16_t maxWait)
// Control Survey-In for NEO-M8P // Control Survey-In for NEO-M8P
bool SFE_UBLOX_GNSS::setSurveyMode(uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait) bool SFE_UBLOX_GNSS::setSurveyMode(uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait)
{
return (setSurveyModeFull(mode, (uint32_t)observationTime, requiredAccuracy, maxWait));
}
bool SFE_UBLOX_GNSS::setSurveyModeFull(uint8_t mode, uint32_t observationTime, float requiredAccuracy, uint16_t maxWait)
{ {
if (getSurveyMode(maxWait) == false) // Ask module for the current TimeMode3 settings. Loads into payloadCfg. if (getSurveyMode(maxWait) == false) // Ask module for the current TimeMode3 settings. Loads into payloadCfg.
return (false); return (false);
@@ -6673,18 +6677,18 @@ bool SFE_UBLOX_GNSS::setSurveyMode(uint8_t mode, uint16_t observationTime, float
// payloadCfg should be loaded with poll response. Now modify only the bits we care about // payloadCfg should be loaded with poll response. Now modify only the bits we care about
payloadCfg[2] = mode; // Set mode. Survey-In and Disabled are most common. Use ECEF (not LAT/LON/ALT). payloadCfg[2] = mode; // Set mode. Survey-In and Disabled are most common. Use ECEF (not LAT/LON/ALT).
// svinMinDur is U4 (uint32_t) but we'll only use a uint16_t (waiting more than 65535 seconds seems excessive!) // svinMinDur is U4 (uint32_t) in seconds
payloadCfg[24] = observationTime & 0xFF; // svinMinDur in seconds payloadCfg[24] = observationTime & 0xFF; // svinMinDur in seconds
payloadCfg[25] = observationTime >> 8; // svinMinDur in seconds payloadCfg[25] = (observationTime >> 8) & 0xFF;
payloadCfg[26] = 0; // Truncate to 16 bits payloadCfg[26] = (observationTime >> 16) & 0xFF;
payloadCfg[27] = 0; // Truncate to 16 bits payloadCfg[27] = (observationTime >> 24) & 0xFF;
// svinAccLimit is U4 (uint32_t) in 0.1mm. // svinAccLimit is U4 (uint32_t) in 0.1mm.
uint32_t svinAccLimit = (uint32_t)(requiredAccuracy * 10000.0); // Convert m to 0.1mm uint32_t svinAccLimit = (uint32_t)(requiredAccuracy * 10000.0); // Convert m to 0.1mm
payloadCfg[28] = svinAccLimit & 0xFF; // svinAccLimit in 0.1mm increments payloadCfg[28] = svinAccLimit & 0xFF; // svinAccLimit in 0.1mm increments
payloadCfg[29] = svinAccLimit >> 8; payloadCfg[29] = (svinAccLimit >> 8) & 0xFF;
payloadCfg[30] = svinAccLimit >> 16; payloadCfg[30] = (svinAccLimit >> 16) & 0xFF;
payloadCfg[31] = svinAccLimit >> 24; payloadCfg[31] = (svinAccLimit >> 24) & 0xFF;
return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
} }
@@ -6692,7 +6696,11 @@ bool SFE_UBLOX_GNSS::setSurveyMode(uint8_t mode, uint16_t observationTime, float
// Begin Survey-In for NEO-M8P // Begin Survey-In for NEO-M8P
bool SFE_UBLOX_GNSS::enableSurveyMode(uint16_t observationTime, float requiredAccuracy, uint16_t maxWait) bool SFE_UBLOX_GNSS::enableSurveyMode(uint16_t observationTime, float requiredAccuracy, uint16_t maxWait)
{ {
return (setSurveyMode(SVIN_MODE_ENABLE, observationTime, requiredAccuracy, maxWait)); return (setSurveyModeFull(SVIN_MODE_ENABLE, (uint32_t)observationTime, requiredAccuracy, maxWait));
}
bool SFE_UBLOX_GNSS::enableSurveyModeFull(uint32_t observationTime, float requiredAccuracy, uint16_t maxWait)
{
return (setSurveyModeFull(SVIN_MODE_ENABLE, observationTime, requiredAccuracy, maxWait));
} }
// Stop Survey-In for NEO-M8P // Stop Survey-In for NEO-M8P
@@ -15554,7 +15562,7 @@ bool SFE_UBLOX_GNSS::getSurveyInValid(uint16_t maxWait)
return ((bool)packetUBXNAVSVIN->data.valid); return ((bool)packetUBXNAVSVIN->data.valid);
} }
uint16_t SFE_UBLOX_GNSS::getSurveyInObservationTime(uint16_t maxWait) // Truncated to 65535 seconds uint32_t SFE_UBLOX_GNSS::getSurveyInObservationTimeFull(uint16_t maxWait) // Return the full uint32_t
{ {
if (packetUBXNAVSVIN == NULL) if (packetUBXNAVSVIN == NULL)
initPacketUBXNAVSVIN(); // Check that RAM has been allocated for the SVIN data initPacketUBXNAVSVIN(); // Check that RAM has been allocated for the SVIN data
@@ -15566,9 +15574,13 @@ uint16_t SFE_UBLOX_GNSS::getSurveyInObservationTime(uint16_t maxWait) // Truncat
packetUBXNAVSVIN->moduleQueried.moduleQueried.bits.dur = false; // Since we are about to give this to user, mark this data as stale packetUBXNAVSVIN->moduleQueried.moduleQueried.bits.dur = false; // Since we are about to give this to user, mark this data as stale
packetUBXNAVSVIN->moduleQueried.moduleQueried.bits.all = false; packetUBXNAVSVIN->moduleQueried.moduleQueried.bits.all = false;
// dur (Passed survey-in observation time) is U4 (uint32_t) seconds. We truncate to 16 bits return (packetUBXNAVSVIN->data.dur);
//(waiting more than 65535 seconds (18.2 hours) seems excessive!) }
uint32_t tmpObsTime = packetUBXNAVSVIN->data.dur;
uint16_t SFE_UBLOX_GNSS::getSurveyInObservationTime(uint16_t maxWait) // Truncated to 65535 seconds
{
// dur (Passed survey-in observation time) is U4 (uint32_t) seconds. Here we truncate to 16 bits
uint32_t tmpObsTime = getSurveyInObservationTimeFull(maxWait);
if (tmpObsTime <= 0xFFFF) if (tmpObsTime <= 0xFFFF)
{ {
return ((uint16_t)tmpObsTime); return ((uint16_t)tmpObsTime);
+4 -1
View File
@@ -846,7 +846,9 @@ public:
// It is probably safe to assume that users of the RTK will be using I2C / Qwiic. So let's leave maxWait set to 250ms. // It is probably safe to assume that users of the RTK will be using I2C / Qwiic. So let's leave maxWait set to 250ms.
bool getSurveyMode(uint16_t maxWait = 250); // Get the current TimeMode3 settings bool getSurveyMode(uint16_t maxWait = 250); // Get the current TimeMode3 settings
bool setSurveyMode(uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Control survey in mode bool setSurveyMode(uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Control survey in mode
bool enableSurveyMode(uint16_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Begin Survey-In for NEO-M8P bool setSurveyModeFull(uint8_t mode, uint32_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Control survey in mode
bool enableSurveyMode(uint16_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Begin Survey-In for NEO-M8P / ZED-F9x
bool enableSurveyModeFull(uint32_t observationTime, float requiredAccuracy, uint16_t maxWait = 250); // Begin Survey-In for NEO-M8P / ZED-F9x
bool disableSurveyMode(uint16_t maxWait = 250); // Stop Survey-In mode bool disableSurveyMode(uint16_t maxWait = 250); // Stop Survey-In mode
// Given coordinates, put receiver into static position. Set latlong to true to pass in lat/long values instead of ecef. // Given coordinates, put receiver into static position. Set latlong to true to pass in lat/long values instead of ecef.
// For ECEF the units are: cm, 0.1mm, cm, 0.1mm, cm, 0.1mm // For ECEF the units are: cm, 0.1mm, cm, 0.1mm, cm, 0.1mm
@@ -1363,6 +1365,7 @@ public:
bool getSurveyInActive(uint16_t maxWait = defaultMaxWait); bool getSurveyInActive(uint16_t maxWait = defaultMaxWait);
bool getSurveyInValid(uint16_t maxWait = defaultMaxWait); bool getSurveyInValid(uint16_t maxWait = defaultMaxWait);
uint16_t getSurveyInObservationTime(uint16_t maxWait = defaultMaxWait); // Truncated to 65535 seconds uint16_t getSurveyInObservationTime(uint16_t maxWait = defaultMaxWait); // Truncated to 65535 seconds
uint32_t getSurveyInObservationTimeFull(uint16_t maxWait = defaultMaxWait); // Return the full uint32_t
float getSurveyInMeanAccuracy(uint16_t maxWait = defaultMaxWait); // Returned as m float getSurveyInMeanAccuracy(uint16_t maxWait = defaultMaxWait); // Returned as m
// Helper functions for TIMELS // Helper functions for TIMELS