Merge pull request #90 from sparkfun/release_candidate

v2.1.3
This commit is contained in:
Paul
2021-12-09 14:45:01 +00:00
committed by GitHub
4 changed files with 121 additions and 25 deletions
+1
View File
@@ -121,6 +121,7 @@ setNMEAOutputPort KEYWORD2
factoryReset KEYWORD2 factoryReset KEYWORD2
hardReset KEYWORD2 hardReset KEYWORD2
softwareResetGNSSOnly KEYWORD2
factoryDefault KEYWORD2 factoryDefault KEYWORD2
saveConfiguration KEYWORD2 saveConfiguration KEYWORD2
+1 -1
View File
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library name=SparkFun u-blox GNSS Arduino Library
version=2.1.2 version=2.1.3
author=SparkFun Electronics <techsupport@sparkfun.com> author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com> maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/> sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/>
+108 -15
View File
@@ -438,7 +438,7 @@ void SFE_UBLOX_GNSS::setPacketCfgPayloadSize(size_t payloadSize)
} }
//Initialize the I2C port //Initialize the I2C port
bool SFE_UBLOX_GNSS::begin(TwoWire &wirePort, uint8_t deviceAddress) bool SFE_UBLOX_GNSS::begin(TwoWire &wirePort, uint8_t deviceAddress, uint16_t maxWait, bool assumeSuccess)
{ {
commType = COMM_TYPE_I2C; commType = COMM_TYPE_I2C;
_i2cPort = &wirePort; //Grab which port the user wants us to use _i2cPort = &wirePort; //Grab which port the user wants us to use
@@ -461,19 +461,46 @@ bool SFE_UBLOX_GNSS::begin(TwoWire &wirePort, uint8_t deviceAddress)
createFileBuffer(); createFileBuffer();
// Call isConnected up to three times - tests on the NEO-M8U show the CFG RATE poll occasionally being ignored // Call isConnected up to three times - tests on the NEO-M8U show the CFG RATE poll occasionally being ignored
bool connected = isConnected(); bool connected = isConnected(maxWait);
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - second attempt"));
}
#endif
connected = isConnected(maxWait);
}
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - third attempt"));
}
#endif
connected = isConnected(maxWait);
}
if ((!connected ) && assumeSuccess) // Advanced users can assume success if required. Useful if the port is outputting messages at high navigation rate.
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: third attempt failed. Assuming success..."));
}
#endif
return (true);
}
return (connected); return (connected);
} }
//Initialize the Serial port //Initialize the Serial port
bool SFE_UBLOX_GNSS::begin(Stream &serialPort) bool SFE_UBLOX_GNSS::begin(Stream &serialPort, uint16_t maxWait, bool assumeSuccess)
{ {
commType = COMM_TYPE_SERIAL; commType = COMM_TYPE_SERIAL;
_serialPort = &serialPort; //Grab which port the user wants us to use _serialPort = &serialPort; //Grab which port the user wants us to use
@@ -486,19 +513,46 @@ bool SFE_UBLOX_GNSS::begin(Stream &serialPort)
createFileBuffer(); createFileBuffer();
// Call isConnected up to three times - tests on the NEO-M8U show the CFG RATE poll occasionally being ignored // Call isConnected up to three times - tests on the NEO-M8U show the CFG RATE poll occasionally being ignored
bool connected = isConnected(); bool connected = isConnected(maxWait);
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - second attempt"));
}
#endif
connected = isConnected(maxWait);
}
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - third attempt"));
}
#endif
connected = isConnected(maxWait);
}
if ((!connected ) && assumeSuccess) // Advanced users can assume success if required. Useful if the port is outputting messages at high navigation rate.
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: third attempt failed. Assuming success..."));
}
#endif
return (true);
}
return (connected); return (connected);
} }
// Initialize for SPI // Initialize for SPI
bool SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpeed) bool SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpeed, uint16_t maxWait, bool assumeSuccess)
{ {
commType = COMM_TYPE_SPI; commType = COMM_TYPE_SPI;
_spiPort = &spiPort; _spiPort = &spiPort;
@@ -538,14 +592,41 @@ bool SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpeed)
} }
} }
// Call isConnected up to three times // Call isConnected up to three times - tests on the NEO-M8U show the CFG RATE poll occasionally being ignored
bool connected = isConnected(); bool connected = isConnected(maxWait);
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - second attempt"));
}
#endif
connected = isConnected(maxWait);
}
if (!connected) if (!connected)
connected = isConnected(); {
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: isConnected - third attempt"));
}
#endif
connected = isConnected(maxWait);
}
if ((!connected ) && assumeSuccess) // Advanced users can assume success if required. Useful if the port is outputting messages at high navigation rate.
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("begin: third attempt failed. Assuming success..."));
}
#endif
return (true);
}
return (connected); return (connected);
} }
@@ -5413,6 +5494,20 @@ void SFE_UBLOX_GNSS::hardReset()
sendCommand(&packetCfg, 0); // don't expect ACK sendCommand(&packetCfg, 0); // don't expect ACK
} }
void SFE_UBLOX_GNSS::softwareResetGNSSOnly()
{
// Issue controlled software reset (GNSS only)
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_RST;
packetCfg.len = 4;
packetCfg.startingSpot = 0;
payloadCfg[0] = 0; // hot start
payloadCfg[1] = 0; // hot start
payloadCfg[2] = 0x02; // 0x02 = Controlled software reset (GNSS only)
payloadCfg[3] = 0; // reserved
sendCommand(&packetCfg, 0); // don't expect ACK
}
//Reset module to factory defaults //Reset module to factory defaults
//This still works but it is the old way of configuring ublox modules. See getVal and setVal for the new methods //This still works but it is the old way of configuring ublox modules. See getVal and setVal for the new methods
bool SFE_UBLOX_GNSS::factoryDefault(uint16_t maxWait) bool SFE_UBLOX_GNSS::factoryDefault(uint16_t maxWait)
@@ -9628,9 +9723,7 @@ bool SFE_UBLOX_GNSS::getNavigationFrequencyInternal(uint16_t maxWait)
return (true); return (true);
if (retVal == SFE_UBLOX_STATUS_DATA_OVERWRITTEN) if (retVal == SFE_UBLOX_STATUS_DATA_OVERWRITTEN)
{
return (true); return (true);
}
return (false); return (false);
} }
+10 -8
View File
@@ -598,12 +598,13 @@ public:
//New in v2.0: allow the payload size for packetCfg to be changed //New in v2.0: allow the payload size for packetCfg to be changed
void setPacketCfgPayloadSize(size_t payloadSize); // Set packetCfgPayloadSize void setPacketCfgPayloadSize(size_t payloadSize); // Set packetCfgPayloadSize
//Begin communication with the GNSS. Advanced users can assume success if required. Useful if the port is already outputting messages at high navigation rate.
//By default use the default I2C address, and use Wire port //By default use the default I2C address, and use Wire port
bool begin(TwoWire &wirePort = Wire, uint8_t deviceAddress = 0x42); //Returns true if module is detected bool begin(TwoWire &wirePort = Wire, uint8_t deviceAddress = 0x42, uint16_t maxWait = defaultMaxWait, bool assumeSuccess = false); //Returns true if module is detected
//serialPort needs to be perviously initialized to correct baud rate //serialPort needs to be perviously initialized to correct baud rate
bool begin(Stream &serialPort); //Returns true if module is detected bool begin(Stream &serialPort, uint16_t maxWait = defaultMaxWait, bool assumeSuccess = false); //Returns true if module is detected
//SPI - supply instance of SPIClass, chip select pin and SPI speed (in Hz) //SPI - supply instance of SPIClass, chip select pin and SPI speed (in Hz)
bool begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpeed); bool begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpeed, uint16_t maxWait = defaultMaxWait, bool assumeSuccess = false);
void end(void); //Stop all automatic message processing. Free all used RAM void end(void); //Stop all automatic message processing. Free all used RAM
@@ -633,7 +634,7 @@ public:
int8_t getMaxNMEAByteCount(void); int8_t getMaxNMEAByteCount(void);
//Returns true if device answers on _gpsI2Caddress address or via Serial //Returns true if device answers on _gpsI2Caddress address or via Serial
bool isConnected(uint16_t maxWait = 1100); bool isConnected(uint16_t maxWait = defaultMaxWait);
// Enable debug messages using the chosen Serial port (Stream) // Enable debug messages using the chosen Serial port (Stream)
// Boards like the RedBoard Turbo use SerialUSB (not Serial). // Boards like the RedBoard Turbo use SerialUSB (not Serial).
@@ -780,6 +781,7 @@ public:
void factoryReset(); //Send factory reset sequence (i.e. load "default" configuration and perform hardReset) void factoryReset(); //Send factory reset sequence (i.e. load "default" configuration and perform hardReset)
void hardReset(); //Perform a reset leading to a cold start (zero info start-up) void hardReset(); //Perform a reset leading to a cold start (zero info start-up)
void softwareResetGNSSOnly(); //Controlled Software Reset (GNSS only) only restarts the GNSS tasks, without reinitializing the full system or reloading any stored configuration.
bool factoryDefault(uint16_t maxWait = defaultMaxWait); //Reset module to factory defaults bool factoryDefault(uint16_t maxWait = defaultMaxWait); //Reset module to factory defaults
//Save configuration to BBR / Flash //Save configuration to BBR / Flash
@@ -826,7 +828,7 @@ public:
bool powerSaveMode(bool power_save = true, uint16_t maxWait = defaultMaxWait); bool powerSaveMode(bool power_save = true, uint16_t maxWait = defaultMaxWait);
uint8_t getPowerSaveMode(uint16_t maxWait = defaultMaxWait); // Returns 255 if the sendCommand fails uint8_t getPowerSaveMode(uint16_t maxWait = defaultMaxWait); // Returns 255 if the sendCommand fails
bool powerOff(uint32_t durationInMs, uint16_t maxWait = defaultMaxWait); bool powerOff(uint32_t durationInMs, uint16_t maxWait = defaultMaxWait);
bool powerOffWithInterrupt(uint32_t durationInMs, uint32_t wakeupSources = VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0, bool forceWhileUsb = true, uint16_t maxWait = 1100); bool powerOffWithInterrupt(uint32_t durationInMs, uint32_t wakeupSources = VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0, bool forceWhileUsb = true, uint16_t maxWait = defaultMaxWait);
//Change the dynamic platform model using UBX-CFG-NAV5 //Change the dynamic platform model using UBX-CFG-NAV5
bool setDynamicModel(dynModel newDynamicModel = DYN_MODEL_PORTABLE, uint16_t maxWait = defaultMaxWait); bool setDynamicModel(dynModel newDynamicModel = DYN_MODEL_PORTABLE, uint16_t maxWait = defaultMaxWait);
@@ -1235,7 +1237,7 @@ public:
// Helper functions for HPPOSECEF // Helper functions for HPPOSECEF
uint32_t getPositionAccuracy(uint16_t maxWait = 1100); //Returns the 3D accuracy of the current high-precision fix, in mm. Supported on NEO-M8P, ZED-F9P, uint32_t getPositionAccuracy(uint16_t maxWait = defaultMaxWait); //Returns the 3D accuracy of the current high-precision fix, in mm. Supported on NEO-M8P, ZED-F9P,
// Helper functions for HPPOSLLH // Helper functions for HPPOSLLH
@@ -1291,8 +1293,8 @@ public:
// Helper functions for HNR // Helper functions for HNR
bool setHNRNavigationRate(uint8_t rate, uint16_t maxWait = 1100); // Returns true if the setHNRNavigationRate is successful bool setHNRNavigationRate(uint8_t rate, uint16_t maxWait = defaultMaxWait); // Returns true if the setHNRNavigationRate is successful
uint8_t getHNRNavigationRate(uint16_t maxWait = 1100); // Returns 0 if the getHNRNavigationRate fails uint8_t getHNRNavigationRate(uint16_t maxWait = defaultMaxWait); // Returns 0 if the getHNRNavigationRate fails
float getHNRroll(uint16_t maxWait = defaultMaxWait); // Returned as degrees float getHNRroll(uint16_t maxWait = defaultMaxWait); // Returned as degrees
float getHNRpitch(uint16_t maxWait = defaultMaxWait); // Returned as degrees float getHNRpitch(uint16_t maxWait = defaultMaxWait); // Returned as degrees
float getHNRheading(uint16_t maxWait = defaultMaxWait); // Returned as degrees float getHNRheading(uint16_t maxWait = defaultMaxWait); // Returned as degrees