Skip to content

v2.1.1 #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 2, 2021
7 changes: 5 additions & 2 deletions .github/workflows/compile-sketch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

- name: Compile Sketch
uses: arduino/compile-sketches@v1
with:
platforms: ${{ matrix.board.platforms }}
fqbn: ${{ matrix.board.fqbn }}
libraries: |
- source-url: https://github.com/${{github.repository}}.git
- source-path: ./
sketch-paths: |
- examples/Example10_AltitudeMSL
- examples/Example11_ResetModule/Example1_FactoryDefaultviaI2C
Expand All @@ -103,11 +106,11 @@ jobs:
- examples/Example14_DebugOutput
- examples/Example15_GetDateTime
- examples/Example16_Nanosecond_MaxOutput
- examples/Example16_PartialSecond_MaxOutput
- examples/Example18_PowerSaveMode
- examples/Example19_DynamicModel
- examples/Example20_SendCustomCommand
enable-warnings-report: true
enable-deltas-report: true
# verbose: true

# outputs:
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library
version=2.1.0
version=2.1.1
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/>
Expand Down
44 changes: 27 additions & 17 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2413,10 +2413,11 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
packetUBXNAVSAT->data.header.version = extractByte(msg, 4);
packetUBXNAVSAT->data.header.numSvs = extractByte(msg, 5);

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

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

if (numDataBytes < 0) // Sanity check. Return now if numDataBytes is negative.
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->println(F("pushAssistNowData: numDataBytes is negative! Aborting..."));
}
#endif
return ((size_t)0);
}

size_t packetsProcessed = 0; // Keep count of how many packets have been processed
size_t bytesPushed = 0; // Keep count

Expand Down Expand Up @@ -4894,14 +4884,15 @@ size_t SFE_UBLOX_GNSS::readNavigationDatabase(uint8_t *dataBytes, size_t maxNumD
while (packetUBXMGAACK->head != packetUBXMGAACK->tail) // Does the MGA ACK ringbuffer contain any data?
{
// Check if we've received the correct ACK
bool idMatch = (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgId == UBX_MGA_DBD); // Check if the message ID matches

bool dataAckd = true;
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgId == UBX_MGA_DBD); // Check if the message ID matches
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[0] == (uint8_t)(databaseEntriesRX & 0xFF)); // Check if the ACK contents match databaseEntriesRX
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[1] == (uint8_t)((databaseEntriesRX >> 8) & 0xFF));
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[2] == (uint8_t)((databaseEntriesRX >> 16) & 0xFF));
dataAckd &= (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[3] == (uint8_t)((databaseEntriesRX >> 24) & 0xFF));

if (dataAckd) // Is the ACK valid?
if (idMatch && dataAckd) // Is the ACK valid?
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
Expand All @@ -4917,6 +4908,25 @@ size_t SFE_UBLOX_GNSS::readNavigationDatabase(uint8_t *dataBytes, size_t maxNumD
#endif
keepGoing = false;
}
else if (idMatch)
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{
_debugSerial->print(F("readNavigationDatabase: unexpected ACK received. databaseEntriesRX is 0x"));
_debugSerial->print(databaseEntriesRX, HEX);
_debugSerial->print(F(". msgPayloadStart is 0x"));
for (uint8_t i = 4; i > 0; i--)
{
if (packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[i - 1] < 0x10)
_debugSerial->print(F("0"));
_debugSerial->print(packetUBXMGAACK->data[packetUBXMGAACK->tail].msgPayloadStart[i - 1], HEX);
}
_debugSerial->println();
}
#endif
}

// Increment the tail
packetUBXMGAACK->tail++;
if (packetUBXMGAACK->tail == UBX_MGA_ACK_DATA0_RINGBUFFER_LEN)
Expand Down
9 changes: 7 additions & 2 deletions src/u-blox_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ typedef struct
} UBX_NAV_TIMELS_t;

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

typedef struct
Expand Down Expand Up @@ -1817,7 +1817,12 @@ typedef struct
uint8_t dbdEntryChecksumB;
} UBX_MGA_DBD_data_t;

#define UBX_MGA_DBD_RINGBUFFER_LEN 256 // Provide storage for MGA DBD packets. TO DO: confirm if 256 is large enough!
#if defined(ARDUINO_AVR_UNO)
#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.)
#else
#define UBX_MGA_DBD_RINGBUFFER_LEN 250 // Provide storage for MGA DBD packets. TO DO: confirm if 250 is large enough for all modules!
#endif

typedef struct
{
uint8_t head;
Expand Down