Skip to content

Commit c933e23

Browse files
committed
Add product variant ID to hardware ID
1 parent 6aa62da commit c933e23

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

Firmware/RTK_Everywhere/Display.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2820,16 +2820,13 @@ void paintKeyProvisionFail(uint16_t displayTime)
28202820
int y = 0;
28212821
int fontHeight = 8;
28222822

2823-
printTextCenter("ZTP", y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
2824-
2825-
y += fontHeight;
28262823
printTextCenter("Failed", y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
28272824

28282825
y += fontHeight;
2829-
printTextCenter("ID:", y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
2826+
printTextCenter("ZTP ID:", y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
28302827

2831-
// The MAC address is 12 characters long so we have to split it onto two lines
2832-
char hardwareID[13];
2828+
// The device ID is 14 characters long so we have to split it into three lines
2829+
char hardwareID[15];
28332830
const uint8_t *rtkMacAddress = getMacAddress();
28342831

28352832
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X", rtkMacAddress[0], rtkMacAddress[1], rtkMacAddress[2]);
@@ -2840,6 +2837,10 @@ void paintKeyProvisionFail(uint16_t displayTime)
28402837
y += fontHeight;
28412838
printTextCenter(hardwareID, y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
28422839

2840+
snprintf(hardwareID, sizeof(hardwareID), "%02X", productVariant);
2841+
y += fontHeight;
2842+
printTextCenter(hardwareID, y, QW_FONT_5X7, 1, false); // text, y, font type, kerning, inverted
2843+
28432844
oled->display();
28442845

28452846
delay(displayTime);

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,9 +1479,9 @@ void createSettingsString(char *newSettings)
14791479
stringRecord(newSettings, "sdMounted", online.microSD);
14801480

14811481
// Add Device ID used for corrections
1482-
char hardwareID[13];
1483-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
1484-
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5]);
1482+
char hardwareID[15];
1483+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
1484+
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5], productVariant);
14851485
stringRecord(newSettings, "hardwareID", hardwareID);
14861486

14871487
// Add Days Remaining for corrections

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ bool pointperfectProvisionDevice()
219219

220220
do
221221
{
222-
char hardwareID[13];
223-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
222+
char hardwareID[15];
223+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
224224
btMACAddress[2], btMACAddress[3], btMACAddress[4],
225-
btMACAddress[5]); // Get ready for JSON
225+
btMACAddress[5], productVariant); // Get ready for JSON
226226

227227
#ifdef WHITELISTED_ID
228228
// Override ID with testing ID
229-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", whitelistID[0], whitelistID[1],
230-
whitelistID[2], whitelistID[3], whitelistID[4], whitelistID[5]);
229+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", whitelistID[0], whitelistID[1],
230+
whitelistID[2], whitelistID[3], whitelistID[4], whitelistID[5], productVariant);
231231
#endif // WHITELISTED_ID
232232

233233
// Given name must be between 1 and 50 characters
@@ -308,9 +308,9 @@ bool pointperfectProvisionDevice()
308308
}
309309
else if (ztpResponse == ZTP_DEACTIVATED && attemptNumber == 1)
310310
{
311-
char hardwareID[13];
312-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
313-
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5]);
311+
char hardwareID[15];
312+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
313+
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5], productVariant);
314314

315315
systemPrintf("This device has been deactivated. Please contact "
316316
"[email protected] to renew the PointPerfect "
@@ -321,9 +321,9 @@ bool pointperfectProvisionDevice()
321321
}
322322
else if (ztpResponse == ZTP_NOT_WHITELISTED && attemptNumber == 1)
323323
{
324-
char hardwareID[13];
325-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
326-
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5]);
324+
char hardwareID[15];
325+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
326+
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5], productVariant);
327327

328328
systemPrintf(
329329
"This device is not whitelisted. Please contact "
@@ -1421,9 +1421,9 @@ void menuPointPerfect()
14211421
}
14221422
else if (incoming == 4 && pointPerfectIsEnabled())
14231423
{
1424-
char hardwareID[13];
1425-
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
1426-
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5]);
1424+
char hardwareID[15];
1425+
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
1426+
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5], productVariant);
14271427
systemPrintf("Device ID: %s\r\n", hardwareID);
14281428
}
14291429
else if (incoming == 'c' && pointPerfectIsEnabled())

0 commit comments

Comments
 (0)