Skip to content

Commit 2b3fe9b

Browse files
authored
Merge pull request #85 from sparkfun/AssistNow
v2.1.1
2 parents 0554837 + 38440b5 commit 2b3fe9b

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

Diff for: .github/workflows/compile-sketch.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ jobs:
8787
steps:
8888
- name: Checkout
8989
uses: actions/checkout@v2
90+
91+
- name: Branch name
92+
run: echo running on branch ${GITHUB_REF##*/}
9093

9194
- name: Compile Sketch
9295
uses: arduino/compile-sketches@v1
9396
with:
9497
platforms: ${{ matrix.board.platforms }}
9598
fqbn: ${{ matrix.board.fqbn }}
9699
libraries: |
97-
- source-url: https://github.com/${{github.repository}}.git
100+
- source-path: ./
98101
sketch-paths: |
99102
- examples/Example10_AltitudeMSL
100103
- examples/Example11_ResetModule/Example1_FactoryDefaultviaI2C
@@ -103,11 +106,11 @@ jobs:
103106
- examples/Example14_DebugOutput
104107
- examples/Example15_GetDateTime
105108
- examples/Example16_Nanosecond_MaxOutput
106-
- examples/Example16_PartialSecond_MaxOutput
107109
- examples/Example18_PowerSaveMode
108110
- examples/Example19_DynamicModel
109111
- examples/Example20_SendCustomCommand
110112
enable-warnings-report: true
113+
enable-deltas-report: true
111114
# verbose: true
112115

113116
# outputs:

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.0
2+
version=2.1.1
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

+27-17
Original file line numberDiff line numberDiff line change
@@ -2413,10 +2413,11 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
24132413
packetUBXNAVSAT->data.header.version = extractByte(msg, 4);
24142414
packetUBXNAVSAT->data.header.numSvs = extractByte(msg, 5);
24152415

2416-
for (uint8_t i = 0; (i < UBX_NAV_SAT_MAX_BLOCKS) && (i < packetUBXNAVSAT->data.header.numSvs)
2417-
&& ((((uint16_t)i) * 12) < (msg->len - 8)); i++)
2416+
// The NAV SAT message could contain data for 255 SVs max. (numSvs is uint8_t. UBX_NAV_SAT_MAX_BLOCKS is 255)
2417+
for (uint16_t i = 0; (i < UBX_NAV_SAT_MAX_BLOCKS) && (i < ((uint16_t)packetUBXNAVSAT->data.header.numSvs))
2418+
&& ((i * 12) < (msg->len - 8)); i++)
24182419
{
2419-
uint16_t offset = (((uint16_t)i) * 12) + 8;
2420+
uint16_t offset = (i * 12) + 8;
24202421
packetUBXNAVSAT->data.blocks[i].gnssId = extractByte(msg, offset + 0);
24212422
packetUBXNAVSAT->data.blocks[i].svId = extractByte(msg, offset + 1);
24222423
packetUBXNAVSAT->data.blocks[i].cno = extractByte(msg, offset + 2);
@@ -4217,7 +4218,7 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
42174218
{
42184219
size_t dataPtr = offset; // Pointer into dataBytes
42194220

4220-
if ((offset >= numDataBytes) || (offset < 0)) // Sanity check. Return now if offset is invalid.
4221+
if (offset >= numDataBytes) // Sanity check. Return now if offset is invalid.
42214222
{
42224223
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
42234224
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
@@ -4230,17 +4231,6 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c
42304231
return ((size_t)0);
42314232
}
42324233

4233-
if (numDataBytes < 0) // Sanity check. Return now if numDataBytes is negative.
4234-
{
4235-
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
4236-
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
4237-
{
4238-
_debugSerial->println(F("pushAssistNowData: numDataBytes is negative! Aborting..."));
4239-
}
4240-
#endif
4241-
return ((size_t)0);
4242-
}
4243-
42444234
size_t packetsProcessed = 0; // Keep count of how many packets have been processed
42454235
size_t bytesPushed = 0; // Keep count
42464236

@@ -4894,14 +4884,15 @@ size_t SFE_UBLOX_GNSS::readNavigationDatabase(uint8_t *dataBytes, size_t maxNumD
48944884
while (packetUBXMGAACK->head != packetUBXMGAACK->tail) // Does the MGA ACK ringbuffer contain any data?
48954885
{
48964886
// Check if we've received the correct ACK
4887+
bool idMatch = (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgId == UBX_MGA_DBD); // Check if the message ID matches
4888+
48974889
bool dataAckd = true;
4898-
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgId == UBX_MGA_DBD); // Check if the message ID matches
48994890
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[0] == (uint8_t)(databaseEntriesRX & 0xFF)); // Check if the ACK contents match databaseEntriesRX
49004891
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[1] == (uint8_t)((databaseEntriesRX >> 8) & 0xFF));
49014892
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[2] == (uint8_t)((databaseEntriesRX >> 16) & 0xFF));
49024893
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[3] == (uint8_t)((databaseEntriesRX >> 24) & 0xFF));
49034894

4904-
if (dataAckd) // Is the ACK valid?
4895+
if (idMatch && dataAckd) // Is the ACK valid?
49054896
{
49064897
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
49074898
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
@@ -4917,6 +4908,25 @@ size_t SFE_UBLOX_GNSS::readNavigationDatabase(uint8_t *dataBytes, size_t maxNumD
49174908
#endif
49184909
keepGoing = false;
49194910
}
4911+
else if (idMatch)
4912+
{
4913+
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
4914+
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
4915+
{
4916+
_debugSerial->print(F("readNavigationDatabase: unexpected ACK received. databaseEntriesRX is 0x"));
4917+
_debugSerial->print(databaseEntriesRX, HEX);
4918+
_debugSerial->print(F(". msgPayloadStart is 0x"));
4919+
for (uint8_t i = 4; i > 0; i--)
4920+
{
4921+
if (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[i - 1] < 0x10)
4922+
_debugSerial->print(F("0"));
4923+
_debugSerial->print(packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[i - 1], HEX);
4924+
}
4925+
_debugSerial->println();
4926+
}
4927+
#endif
4928+
}
4929+
49204930
// Increment the tail
49214931
packetUBXMGAACK->tail++;
49224932
if (packetUBXMGAACK->tail == UBX_MGA_ACK_DATA0_RINGBUFFER_LEN)

Diff for: src/u-blox_structs.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ typedef struct
917917
} UBX_NAV_TIMELS_t;
918918

919919
// UBX-NAV-SAT (0x01 0x35): Satellite Information
920-
const uint16_t UBX_NAV_SAT_MAX_BLOCKS = 256; // TO DO: confirm if this is large enough for all modules
920+
const uint16_t UBX_NAV_SAT_MAX_BLOCKS = 255; // numSvs is 8-bit
921921
const uint16_t UBX_NAV_SAT_MAX_LEN = 8 + (12 * UBX_NAV_SAT_MAX_BLOCKS);
922922

923923
typedef struct
@@ -1817,7 +1817,12 @@ typedef struct
18171817
uint8_t dbdEntryChecksumB;
18181818
} UBX_MGA_DBD_data_t;
18191819

1820-
#define UBX_MGA_DBD_RINGBUFFER_LEN 256 // Provide storage for MGA DBD packets. TO DO: confirm if 256 is large enough!
1820+
#if defined(ARDUINO_AVR_UNO)
1821+
#define UBX_MGA_DBD_RINGBUFFER_LEN 3 // Fix to let the code compile on the UNO. (The UNO does not have enough RAM to store the database.)
1822+
#else
1823+
#define UBX_MGA_DBD_RINGBUFFER_LEN 250 // Provide storage for MGA DBD packets. TO DO: confirm if 250 is large enough for all modules!
1824+
#endif
1825+
18211826
typedef struct
18221827
{
18231828
uint8_t head;

0 commit comments

Comments
 (0)