Merge pull request #165 from sparkfun/release_candidate
Add autoSendCfgValsetAtSpaceRemaining. Update Example9
This commit is contained in:
@@ -66,6 +66,13 @@ void setup()
|
|||||||
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
|
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
|
||||||
//Original: myGNSS.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
|
||||||
|
|
||||||
|
//If we will be sending a large number of key IDs and values, packetCfg could fill up before the CFG_VALSET is sent...
|
||||||
|
//There are three possible solutions:
|
||||||
|
// Increase the space available by calling myGNSS.setPacketCfgPayloadSize
|
||||||
|
// Monitor how much space is remaining by calling myGNSS.getCfgValsetSpaceRemaining. Call myGNSS.sendCfgValset(); before packetCfg becomes full.
|
||||||
|
// Call myGNSS.autoSendCfgValsetAtSpaceRemaining(16); . This will cause the existing CFG_VALSET to be send automatically and a new one created when packetCfg has less than 16 bytes remaining.
|
||||||
|
myGNSS.autoSendCfgValsetAtSpaceRemaining(16); // Trigger an auto-send when packetCfg has less than 16 bytes are remaining
|
||||||
|
|
||||||
//Begin with newCfgValset
|
//Begin with newCfgValset
|
||||||
setValueSuccess &= myGNSS.newCfgValset(); // Defaults to configuring the setting in Flash, RAM and BBR
|
setValueSuccess &= myGNSS.newCfgValset(); // Defaults to configuring the setting in Flash, RAM and BBR
|
||||||
//setValueSuccess &= myGNSS.newCfgValset(VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
|
//setValueSuccess &= myGNSS.newCfgValset(VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ sendCfgValset64 KEYWORD2
|
|||||||
sendCfgValset KEYWORD2
|
sendCfgValset KEYWORD2
|
||||||
getCfgValsetLen KEYWORD2
|
getCfgValsetLen KEYWORD2
|
||||||
getCfgValsetSpaceRemaining KEYWORD2
|
getCfgValsetSpaceRemaining KEYWORD2
|
||||||
|
autoSendCfgValsetAtSpaceRemaining KEYWORD2
|
||||||
|
|
||||||
getNAVPOSECEF KEYWORD2
|
getNAVPOSECEF KEYWORD2
|
||||||
setAutoNAVPOSECEF KEYWORD2
|
setAutoNAVPOSECEF KEYWORD2
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name=SparkFun u-blox GNSS Arduino Library
|
name=SparkFun u-blox GNSS Arduino Library
|
||||||
version=2.2.18
|
version=2.2.19
|
||||||
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, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
|
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
|
||||||
|
|||||||
@@ -9337,6 +9337,19 @@ uint8_t SFE_UBLOX_GNSS::newCfgValset(uint8_t layer)
|
|||||||
// This function takes a full 32-bit key and 64-bit value
|
// This function takes a full 32-bit key and 64-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::addCfgValset64(uint32_t key, uint64_t value)
|
uint8_t SFE_UBLOX_GNSS::addCfgValset64(uint32_t key, uint64_t value)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("addCfgValset64: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 12))
|
if (packetCfg.len >= (packetCfgPayloadSize - 12))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9384,6 +9397,19 @@ uint8_t SFE_UBLOX_GNSS::addCfgValset64(uint32_t key, uint64_t value)
|
|||||||
// This function takes a full 32-bit key and 32-bit value
|
// This function takes a full 32-bit key and 32-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::addCfgValset32(uint32_t key, uint32_t value)
|
uint8_t SFE_UBLOX_GNSS::addCfgValset32(uint32_t key, uint32_t value)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("addCfgValset32: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 8))
|
if (packetCfg.len >= (packetCfgPayloadSize - 8))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9427,6 +9453,19 @@ uint8_t SFE_UBLOX_GNSS::addCfgValset32(uint32_t key, uint32_t value)
|
|||||||
// This function takes a full 32-bit key and 16-bit value
|
// This function takes a full 32-bit key and 16-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::addCfgValset16(uint32_t key, uint16_t value)
|
uint8_t SFE_UBLOX_GNSS::addCfgValset16(uint32_t key, uint16_t value)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("addCfgValset16: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 6))
|
if (packetCfg.len >= (packetCfgPayloadSize - 6))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9468,6 +9507,19 @@ uint8_t SFE_UBLOX_GNSS::addCfgValset16(uint32_t key, uint16_t value)
|
|||||||
// This function takes a full 32-bit key and 8-bit value
|
// This function takes a full 32-bit key and 8-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::addCfgValset8(uint32_t key, uint8_t value)
|
uint8_t SFE_UBLOX_GNSS::addCfgValset8(uint32_t key, uint8_t value)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("addCfgValset8: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 5))
|
if (packetCfg.len >= (packetCfgPayloadSize - 5))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9508,6 +9560,19 @@ uint8_t SFE_UBLOX_GNSS::addCfgValset8(uint32_t key, uint8_t value)
|
|||||||
// This function takes a full 32-bit key and 64-bit value
|
// This function takes a full 32-bit key and 64-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::sendCfgValset64(uint32_t key, uint64_t value, uint16_t maxWait)
|
uint8_t SFE_UBLOX_GNSS::sendCfgValset64(uint32_t key, uint64_t value, uint16_t maxWait)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("sendCfgValset64: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 12))
|
if (packetCfg.len >= (packetCfgPayloadSize - 12))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9536,6 +9601,19 @@ uint8_t SFE_UBLOX_GNSS::sendCfgValset64(uint32_t key, uint64_t value, uint16_t m
|
|||||||
// This function takes a full 32-bit key and 32-bit value
|
// This function takes a full 32-bit key and 32-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::sendCfgValset32(uint32_t key, uint32_t value, uint16_t maxWait)
|
uint8_t SFE_UBLOX_GNSS::sendCfgValset32(uint32_t key, uint32_t value, uint16_t maxWait)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("sendCfgValset32: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 8))
|
if (packetCfg.len >= (packetCfgPayloadSize - 8))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9564,6 +9642,19 @@ uint8_t SFE_UBLOX_GNSS::sendCfgValset32(uint32_t key, uint32_t value, uint16_t m
|
|||||||
// This function takes a full 32-bit key and 16-bit value
|
// This function takes a full 32-bit key and 16-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::sendCfgValset16(uint32_t key, uint16_t value, uint16_t maxWait)
|
uint8_t SFE_UBLOX_GNSS::sendCfgValset16(uint32_t key, uint16_t value, uint16_t maxWait)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("sendCfgValset16: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 6))
|
if (packetCfg.len >= (packetCfgPayloadSize - 6))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9592,6 +9683,19 @@ uint8_t SFE_UBLOX_GNSS::sendCfgValset16(uint32_t key, uint16_t value, uint16_t m
|
|||||||
// This function takes a full 32-bit key and 8-bit value
|
// This function takes a full 32-bit key and 8-bit value
|
||||||
uint8_t SFE_UBLOX_GNSS::sendCfgValset8(uint32_t key, uint8_t value, uint16_t maxWait)
|
uint8_t SFE_UBLOX_GNSS::sendCfgValset8(uint32_t key, uint8_t value, uint16_t maxWait)
|
||||||
{
|
{
|
||||||
|
if ((_autoSendAtSpaceRemaining > 0) && (packetCfg.len >= (packetCfgPayloadSize - _autoSendAtSpaceRemaining)))
|
||||||
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
|
_debugSerial->println(F("sendCfgValset8: autosend"));
|
||||||
|
#endif
|
||||||
|
sendCommand(&packetCfg);
|
||||||
|
packetCfg.len = 4; // 4 byte header
|
||||||
|
packetCfg.startingSpot = 0;
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
memset(&payloadCfg[4], 0, packetCfgPayloadSize - 4);
|
||||||
|
}
|
||||||
|
|
||||||
if (packetCfg.len >= (packetCfgPayloadSize - 5))
|
if (packetCfg.len >= (packetCfgPayloadSize - 5))
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
@@ -9619,10 +9723,16 @@ uint8_t SFE_UBLOX_GNSS::sendCfgValset8(uint32_t key, uint8_t value, uint16_t max
|
|||||||
// Send the UBX-CFG-VALSET ubxPacket
|
// Send the UBX-CFG-VALSET ubxPacket
|
||||||
uint8_t SFE_UBLOX_GNSS::sendCfgValset(uint16_t maxWait)
|
uint8_t SFE_UBLOX_GNSS::sendCfgValset(uint16_t maxWait)
|
||||||
{
|
{
|
||||||
_numCfgKeyIDs = 0;
|
if (_numCfgKeyIDs == 0)
|
||||||
|
return true; // Nothing to send...
|
||||||
|
|
||||||
// Send VALSET command with this key and value
|
// Send VALSET command with this key and value
|
||||||
return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
|
bool success = sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT; // We are only expecting an ACK
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
_numCfgKeyIDs = 0;
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the number of keys in the CfgValset
|
// Return the number of keys in the CfgValset
|
||||||
|
|||||||
@@ -996,6 +996,7 @@ public:
|
|||||||
uint8_t sendCfgValset(uint16_t maxWait = defaultMaxWait); // Send the CfgValset (UBX-CFG-VALSET) construct
|
uint8_t sendCfgValset(uint16_t maxWait = defaultMaxWait); // Send the CfgValset (UBX-CFG-VALSET) construct
|
||||||
uint8_t getCfgValsetLen(); // Returns the length of the current CfgValset construct as number-of-keyIDs
|
uint8_t getCfgValsetLen(); // Returns the length of the current CfgValset construct as number-of-keyIDs
|
||||||
size_t getCfgValsetSpaceRemaining(); // Returns the number of free bytes remaining in packetCfg
|
size_t getCfgValsetSpaceRemaining(); // Returns the number of free bytes remaining in packetCfg
|
||||||
|
void autoSendCfgValsetAtSpaceRemaining(size_t spaceRemaining) { _autoSendAtSpaceRemaining = spaceRemaining; } // Cause CFG_VALSET packets to be sent automatically when packetCfg has less than this many bytes available
|
||||||
|
|
||||||
// get and set functions for all of the "automatic" message processing
|
// get and set functions for all of the "automatic" message processing
|
||||||
|
|
||||||
@@ -1796,6 +1797,9 @@ private:
|
|||||||
|
|
||||||
// Keep track of how many keys have been added to CfgValset
|
// Keep track of how many keys have been added to CfgValset
|
||||||
uint8_t _numCfgKeyIDs = 0;
|
uint8_t _numCfgKeyIDs = 0;
|
||||||
|
|
||||||
|
// Send the current CFG_VALSET message when packetCfg has less than this many bytes available
|
||||||
|
size_t _autoSendAtSpaceRemaining = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user