Skip to content

Commit d67c1e1

Browse files
authored
Merge pull request #96 from sparkfun/release_candidate
v2.1.5
2 parents 8282d24 + 65a731a commit d67c1e1

3 files changed

+14
-23
lines changed

Diff for: library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun u-blox GNSS Arduino Library
2-
version=2.1.4
2+
version=2.1.5
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/>

Diff for: src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

+10-21
Original file line numberDiff line numberDiff line change
@@ -4363,20 +4363,6 @@ size_t SFE_UBLOX_GNSS::pushAssistNowData(size_t offset, bool skipTime, const uin
43634363
size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait)
43644364
{
43654365
size_t dataPtr = offset; // Pointer into dataBytes
4366-
4367-
if (offset >= numDataBytes) // Sanity check. Return now if offset is invalid.
4368-
{
4369-
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
4370-
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
4371-
{
4372-
_debugSerial->print(F("pushAssistNowData: offset ("));
4373-
_debugSerial->print(offset);
4374-
_debugSerial->println(F(") is invalid! Aborting..."));
4375-
}
4376-
#endif
4377-
return ((size_t)0);
4378-
}
4379-
43804366
size_t packetsProcessed = 0; // Keep count of how many packets have been processed
43814367
size_t bytesPushed = 0; // Keep count
43824368

@@ -4406,7 +4392,7 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
44064392
return (0);
44074393
}
44084394

4409-
while (dataPtr < numDataBytes) // Keep going until we have processed all the bytes
4395+
while (dataPtr < (offset + numDataBytes)) // Keep going until we have processed all the bytes
44104396
{
44114397
// Start by checking the validity of the packet being pointed to
44124398
bool dataIsOK = true;
@@ -4421,8 +4407,8 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
44214407
uint8_t checksumB = 0;
44224408
// Calculate the checksum bytes
44234409
// Keep going until the end of the packet is reached (payloadPtr == (dataPtr + packetLength))
4424-
// or we reach the end of the AssistNow data (payloadPtr == numDataBytes)
4425-
for (size_t payloadPtr = dataPtr + ((size_t)2); (payloadPtr < (dataPtr + packetLength + ((size_t)6))) && (payloadPtr < numDataBytes); payloadPtr++)
4410+
// or we reach the end of the AssistNow data (payloadPtr == offset + numDataBytes)
4411+
for (size_t payloadPtr = dataPtr + ((size_t)2); (payloadPtr < (dataPtr + packetLength + ((size_t)6))) && (payloadPtr < (offset + numDataBytes)); payloadPtr++)
44264412
{
44274413
checksumA += *(dataBytes + payloadPtr);
44284414
checksumB += checksumA;
@@ -4431,7 +4417,7 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
44314417
dataIsOK &= (checksumA == *(dataBytes + dataPtr + packetLength + ((size_t)6)));
44324418
dataIsOK &= (checksumB == *(dataBytes + dataPtr + packetLength + ((size_t)7)));
44334419

4434-
dataIsOK &= ((dataPtr + packetLength + ((size_t)8)) <= numDataBytes); // Check we haven't overrun
4420+
dataIsOK &= ((dataPtr + packetLength + ((size_t)8)) <= (offset + numDataBytes)); // Check we haven't overrun
44354421

44364422
// If the data is valid, push it
44374423
if (dataIsOK)
@@ -4527,7 +4513,7 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
45274513
// We are not checking for Acks, so let's assume the send was successful?
45284514
packetsProcessed++;
45294515
// We are not checking for Acks, so delay for maxWait millis unless we've reached the end of the data
4530-
if ((dataPtr + packetLength + ((size_t)8)) < numDataBytes)
4516+
if ((dataPtr + packetLength + ((size_t)8)) < (offset + numDataBytes))
45314517
{
45324518
delay(maxWait);
45334519
}
@@ -4548,7 +4534,7 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
45484534
}
45494535
#endif
45504536

4551-
while ((dataPtr < numDataBytes) && (*(dataBytes + ++dataPtr) != UBX_SYNCH_1))
4537+
while ((dataPtr < (offset + numDataBytes)) && (*(dataBytes + ++dataPtr) != UBX_SYNCH_1))
45524538
{
45534539
; // Increment dataPtr until we are pointing at the next 0xB5 - or we reach the end of the data
45544540
}
@@ -4582,7 +4568,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXMGAACK()
45824568
}
45834569

45844570
// Provide initial time assistance
4585-
bool SFE_UBLOX_GNSS::setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos, uint16_t tAccS, uint32_t tAccNs, uint8_t source, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait)
4571+
bool SFE_UBLOX_GNSS::setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day,
4572+
uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos,
4573+
uint16_t tAccS, uint32_t tAccNs, uint8_t source,
4574+
sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait)
45864575
{
45874576
uint8_t iniTimeUTC[32]; // Create the UBX-MGA-INI-TIME_UTC message by hand
45884577
memset(iniTimeUTC, 0x00, 32); // Set all unused / reserved bytes and the checksum to zero

Diff for: src/SparkFun_u-blox_GNSS_Arduino_Library.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,9 @@ class SFE_UBLOX_GNSS
727727
#define defaultMGAINITIMEtAccS 2 // Default to setting the seconds time accuracy to 2 seconds
728728
#define defaultMGAINITIMEtAccNs 0 // Default to setting the nanoseconds time accuracy to zero
729729
#define defaultMGAINITIMEsource 0 // Set default source to none, i.e. on receipt of message (will be inaccurate!)
730-
bool setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos = 0, uint16_t tAccS = defaultMGAINITIMEtAccS, uint32_t tAccNs = defaultMGAINITIMEtAccNs, uint8_t source = defaultMGAINITIMEsource, sfe_ublox_mga_assist_ack_e mgaAck = SFE_UBLOX_MGA_ASSIST_ACK_NO, uint16_t maxWait = defaultMGAdelay);
730+
bool setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos = 0,
731+
uint16_t tAccS = defaultMGAINITIMEtAccS, uint32_t tAccNs = defaultMGAINITIMEtAccNs, uint8_t source = defaultMGAINITIMEsource,
732+
sfe_ublox_mga_assist_ack_e mgaAck = SFE_UBLOX_MGA_ASSIST_ACK_NO, uint16_t maxWait = defaultMGAdelay);
731733

732734
// Provide initial position assistance
733735
// The units for ecefX/Y/Z and posAcc (stddev) are cm.

0 commit comments

Comments
 (0)