Skip to content

Commit

Permalink
Add support for module unique ID
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulZC committed May 29, 2023
1 parent ef6f499 commit 52fca37
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,12 @@ void beginGNSS()
printZEDInfo(); // Print module type and firmware version
}

UBX_SEC_UNIQID_data_t chipID;
if (theGNSS.getUniqueChipId(&chipID))
{
snprintf(zedUniqueId, sizeof(zedUniqueId), "%s", theGNSS.getUniqueChipIdStr(&chipID));
}

online.gnss = true;
}

Expand Down
4 changes: 2 additions & 2 deletions Firmware/RTK_Surveyor/Form.ino
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ void createSettingsString(char *newSettings)
strcpy(apZedPlatform, "ZED-F9R");

char apZedFirmwareVersion[80];
snprintf(apZedFirmwareVersion, sizeof(apZedFirmwareVersion), "%s Firmware: %s", apZedPlatform,
zedFirmwareVersion);
snprintf(apZedFirmwareVersion, sizeof(apZedFirmwareVersion), "%s Firmware: %s ID: %s", apZedPlatform,
zedFirmwareVersion, zedUniqueId);
stringRecord(newSettings, "zedFirmwareVersion", apZedFirmwareVersion);
stringRecord(newSettings, "zedFirmwareVersionInt", zedFirmwareVersionInt);
}
Expand Down
5 changes: 5 additions & 0 deletions Firmware/RTK_Surveyor/NVM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ void recordSystemSettingsToFile(File *settingsFile)

settingsFile->printf("%s=%s\r\n", "zedFirmwareVersion", zedFirmwareVersion);

settingsFile->printf("%s=%s\r\n", "zedUniqueId", zedUniqueId);

if (productVariant == RTK_FACET_LBAND)
settingsFile->printf("%s=%s\r\n", "neoFirmwareVersion", neoFirmwareVersion);

Expand Down Expand Up @@ -744,6 +746,9 @@ bool parseLine(char *str, Settings *settings)
else if (strcmp(settingName, "zedFirmwareVersion") == 0)
{
} // Do nothing. Just read it to avoid 'Unknown setting' error
else if (strcmp(settingName, "zedUniqueId") == 0)
{
} // Do nothing. Just read it to avoid 'Unknown setting' error
else if (strcmp(settingName, "neoFirmwareVersion") == 0)
{
} // Do nothing. Just read it to avoid 'Unknown setting' error
Expand Down
1 change: 1 addition & 0 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ char neoFirmwareVersion[20]; // Output to system status menu.
uint8_t zedFirmwareVersionInt = 0; // Controls which features (constellations) can be configured (v1.12 doesn't support
// SBAS). Note: will fail above 2.55!
uint8_t zedModuleType = PLATFORM_F9P; // Controls which messages are supported and configured
char zedUniqueId[11] = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 0 }; // Output to system status menu and log file.

// Use Michael's lock/unlock methods to prevent the UART2 task from calling checkUblox during a sendCommand and
// waitForResponse. Also prevents pushRawData from being called too.
Expand Down
5 changes: 5 additions & 0 deletions Firmware/RTK_Surveyor/menuMessages.ino
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,11 @@ void beginLogging(const char *customFileName)
zedFirmwareVersion); // textID, buffer, sizeOfBuffer, text
ubxFile->println(nmeaMessage);

// ZED-F9 unique chip ID
createNMEASentence(CUSTOM_NMEA_TYPE_ZED_UNIQUE_ID, nmeaMessage, sizeof(nmeaMessage),
zedUniqueId); // textID, buffer, sizeOfBuffer, text
ubxFile->println(nmeaMessage);

// Device BT MAC. See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/346
char macAddress[5];
snprintf(macAddress, sizeof(macAddress), "%02X%02X", btMACAddress[4], btMACAddress[5]);
Expand Down
2 changes: 2 additions & 0 deletions Firmware/RTK_Surveyor/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ void menuSystem()

printZEDInfo();

systemPrintf("Module unique chip ID: %s\r\n", zedUniqueId);

printCurrentConditions();
}
else
Expand Down
1 change: 1 addition & 0 deletions Firmware/RTK_Surveyor/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ typedef enum
CUSTOM_NMEA_TYPE_PARSER_STATS,
CUSTOM_NMEA_TYPE_CURRENT_DATE,
CUSTOM_NMEA_TYPE_ARP_ECEF_XYZH,
CUSTOM_NMEA_TYPE_ZED_UNIQUE_ID,
} customNmeaType_e;

// Freeze and blink LEDs if we hit a bad error
Expand Down

0 comments on commit 52fca37

Please sign in to comment.