@@ -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;
0 commit comments