Skip to content

Commit c4d8a2e

Browse files
committed
v3.0.1
1 parent ce308d6 commit c4d8a2e

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

examples/Basics/Example8_GetModuleInfo/Example8_GetModuleInfo.ino

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ void setup()
5151

5252
if (myGNSS.getModuleInfo())
5353
{
54-
Serial.print(F("FWVER: "));
55-
Serial.print(myGNSS.getFirmwareVersionHigh());
56-
Serial.print(F("."));
57-
Serial.println(myGNSS.getFirmwareVersionLow());
58-
59-
Serial.print(F("Firmware: "));
60-
Serial.println(myGNSS.getFirmwareType());
54+
Serial.print(F("FWVER: "));
55+
Serial.print(myGNSS.getFirmwareVersionHigh()); // Returns uint8_t
56+
Serial.print(F("."));
57+
Serial.println(myGNSS.getFirmwareVersionLow()); // Returns uint8_t
58+
59+
Serial.print(F("Firmware: "));
60+
Serial.println(myGNSS.getFirmwareType()); // Returns HPG, SPG etc. as (const char *)
6161

62-
Serial.print(F("PROTVER: "));
63-
Serial.print(myGNSS.getProtocolVersionHigh());
64-
Serial.print(F("."));
65-
Serial.println(myGNSS.getProtocolVersionLow());
66-
67-
Serial.print(F("MOD: "));
68-
Serial.println(myGNSS.getModuleName());
62+
Serial.print(F("PROTVER: "));
63+
Serial.print(myGNSS.getProtocolVersionHigh()); // Returns uint8_t
64+
Serial.print(F("."));
65+
Serial.println(myGNSS.getProtocolVersionLow()); // Returns uint8_t
66+
67+
Serial.print(F("MOD: "));
68+
Serial.println(myGNSS.getModuleName()); // Returns ZED-F9P, MAX-M10S etc. as (const char *)
6969
}
7070
else
7171
Serial.println(F("Error: could not read module info!"));

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun u-blox GNSS v3
2-
version=3.0.0
2+
version=3.0.1
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>

src/u-blox_GNSS.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6902,8 +6902,6 @@ bool DevUBLOXGNSS::getModuleInfo(uint16_t maxWait)
69026902

69036903
// Payload should now contain ~220 characters (depends on module type)
69046904

6905-
moduleSWVersion->moduleQueried = true; // Mark this data as new
6906-
69076905
// We will step through the payload looking at each extension field of 30 bytes
69086906
char *ptr;
69096907
uint8_t fwProtMod = 0; // Flags to show if we extracted the FWVER, PROTVER and MOD data
@@ -6913,12 +6911,14 @@ bool DevUBLOXGNSS::getModuleInfo(uint16_t maxWait)
69136911
if (ptr != nullptr)
69146912
{
69156913
ptr += strlen("FWVER="); // Point to the firmware type (HPG etc.)
6916-
for (int i = 0; i < firmwareTypeLen; i++) // Extract the firmware type (3 chars)
6917-
moduleSWVersion->firmwareType[i] = *ptr++;
6918-
moduleSWVersion->firmwareType[firmwareTypeLen] = '\0'; // NULL-terminate
6914+
int i = 0;
6915+
while ((i < firmwareTypeLen) && (*ptr != '\0') && (*ptr != ' ')) // Extract the firmware type (3 chars)
6916+
moduleSWVersion->firmwareType[i++] = *ptr++;
6917+
moduleSWVersion->firmwareType[i] = '\0'; // NULL-terminate
69196918

69206919
if (*ptr == ' ')
69216920
ptr++; // Skip the space
6921+
69226922
int firmwareHi = 0;
69236923
int firmwareLo = 0;
69246924
int scanned = sscanf(ptr, "%d.%d", &firmwareHi, &firmwareLo);
@@ -6949,9 +6949,7 @@ bool DevUBLOXGNSS::getModuleInfo(uint16_t maxWait)
69496949
ptr += strlen("MOD="); // Point to the module name
69506950
int i = 0;
69516951
while ((i < moduleNameMaxLen) && (*ptr != '\0') && (*ptr != ' ')) // Copy the module name
6952-
{
69536952
moduleSWVersion->moduleName[i++] = *ptr++;
6954-
}
69556953
moduleSWVersion->moduleName[i] = '\0'; // NULL-terminate
69566954
fwProtMod |= 0x04; // Record that we got the MOD
69576955
}
@@ -6974,6 +6972,9 @@ bool DevUBLOXGNSS::getModuleInfo(uint16_t maxWait)
69746972
_debugSerial.println(moduleSWVersion->moduleName);
69756973
}
69766974
#endif
6975+
6976+
moduleSWVersion->moduleQueried = true; // Mark this data as new
6977+
69776978
return (true);
69786979
}
69796980

@@ -6992,7 +6993,7 @@ bool DevUBLOXGNSS::initModuleSWVersion()
69926993
#endif
69936994
return (false);
69946995
}
6995-
moduleSWVersion->protocolVersionHigh = 0;
6996+
moduleSWVersion->protocolVersionHigh = 0; // Clear the contents
69966997
moduleSWVersion->protocolVersionLow = 0;
69976998
moduleSWVersion->firmwareVersionHigh = 0;
69986999
moduleSWVersion->firmwareVersionLow = 0;

src/u-blox_external_typedefs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ typedef struct
215215
} geofenceParams_t;
216216

217217
// Struct to hold the module software version
218-
#define firmwareTypeLen 3
219-
#define moduleNameMaxLen 10
218+
#define firmwareTypeLen 3 // HPG, SPG, etc.
219+
#define moduleNameMaxLen 13 // Allow for: 4-chars minus 4-chars minus 3-chars
220220
typedef struct
221221
{
222-
uint8_t protocolVersionLow; // Loaded from getModuleInfo() / getProtocolVersion()
222+
uint8_t protocolVersionLow; // Loaded from getModuleInfo()
223223
uint8_t protocolVersionHigh;
224224
uint8_t firmwareVersionLow;
225225
uint8_t firmwareVersionHigh;

0 commit comments

Comments
 (0)