diff --git a/.github/workflows/compile-sketch.yml b/.github/workflows/compile-sketch.yml index 97efba1..8a225b7 100644 --- a/.github/workflows/compile-sketch.yml +++ b/.github/workflows/compile-sketch.yml @@ -87,6 +87,9 @@ 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 @@ -94,7 +97,7 @@ jobs: 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 @@ -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: diff --git a/library.properties b/library.properties index 08eb80d..2201468 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun u-blox GNSS Arduino Library -version=2.1.0 +version=2.1.1 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=Library for I2C and Serial Communication with u-blox GNSS modules

diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index a8e1e1f..391355e 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -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); @@ -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 @@ -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 @@ -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 @@ -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) diff --git a/src/u-blox_structs.h b/src/u-blox_structs.h index be78cfe..4a6791d 100644 --- a/src/u-blox_structs.h +++ b/src/u-blox_structs.h @@ -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 @@ -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;