Skip to content

v2.2.26 - resolve issue #217 #218

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 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.2.25
version=2.2.26
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
Expand Down
36 changes: 22 additions & 14 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7725,25 +7725,33 @@ bool SFE_UBLOX_GNSS::getProtocolVersion(uint16_t maxWait)
// }

// We will step through the payload looking at each extension field of 30 bytes
for (uint8_t extensionNumber = 0; extensionNumber < 10; extensionNumber++)
char *ptr;
for (uint8_t extensionNumber = 0; extensionNumber < ((packetCfg.len - 40) / 30); extensionNumber++)
{
// Now we need to find "PROTVER=18.00" in the incoming byte stream
if ((payloadCfg[(30 * extensionNumber) + 0] == 'P') && (payloadCfg[(30 * extensionNumber) + 6] == 'R'))
ptr = strstr((const char *)&payloadCfg[(30 * extensionNumber)], "PROTVER="); // Check for PROTVER (should be in extension 2)
if (ptr != nullptr)
{
moduleSWVersion->versionHigh = (payloadCfg[(30 * extensionNumber) + 8] - '0') * 10 + (payloadCfg[(30 * extensionNumber) + 9] - '0'); // Convert '18' to 18
moduleSWVersion->versionLow = (payloadCfg[(30 * extensionNumber) + 11] - '0') * 10 + (payloadCfg[(30 * extensionNumber) + 12] - '0'); // Convert '00' to 00
moduleSWVersion->moduleQueried = true; // Mark this data as new
ptr += strlen("PROTVER="); // Point to the protocol version
int protHi = 0;
int protLo = 0;
int scanned = sscanf(ptr, "%d.%d", &protHi, &protLo);
if (scanned == 2) // Check we extracted the firmware version successfully
{
moduleSWVersion->versionHigh = protHi;
moduleSWVersion->versionLow = protLo;
moduleSWVersion->moduleQueried = true; // Mark this data as new

#ifndef SFE_UBLOX_REDUCED_PROG_MEM
if (_printDebug == true)
{
_debugSerial->print(F("Protocol version: "));
_debugSerial->print(moduleSWVersion->versionHigh);
_debugSerial->print(F("."));
_debugSerial->println(moduleSWVersion->versionLow);
}
if (_printDebug == true)
{
_debugSerial->print(F("Protocol version: "));
_debugSerial->print(moduleSWVersion->versionHigh);
_debugSerial->print(F("."));
_debugSerial->println(moduleSWVersion->versionLow);
}
#endif
return (true); // Success!
return (true); // Success!
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/SparkFun_u-blox_GNSS_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ enum sfe_ublox_rxm_mode_e

#ifndef MAX_PAYLOAD_SIZE
// v2.0: keep this for backwards-compatibility, but this is largely superseded by setPacketCfgPayloadSize
#define MAX_PAYLOAD_SIZE 256 // We need ~220 bytes for getProtocolVersion on most ublox modules
#define MAX_PAYLOAD_SIZE 276 // We need >=250 bytes for getProtocolVersion on the NEO-F10N
//#define MAX_PAYLOAD_SIZE 768 //Worst case: UBX_CFG_VALSET packet with 64 keyIDs each with 64 bit values
#endif

Expand Down
Loading