Skip to content

Commit 0072bc0

Browse files
committed
Correctly print device ID in error message
1 parent 5f19e58 commit 0072bc0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,11 +2253,11 @@ void paintKeyProvisionFail(uint16_t displayTime)
22532253
{
22542254
oled.erase();
22552255

2256-
oled.setFont(QW_FONT_8X16);
2256+
oled.setFont(QW_FONT_5X7);
22572257

22582258
int x = (oled.getWidth() / 2); //Center point for x coord
22592259
int y = 0;
2260-
int fontHeight = 13;
2260+
int fontHeight = 8;
22612261
int textX;
22622262

22632263
textX = x - (oled.getStringWidth("ZTP") / 2); //Starting point of text
@@ -2274,13 +2274,20 @@ void paintKeyProvisionFail(uint16_t displayTime)
22742274
oled.setCursor(textX, y);
22752275
oled.print("ID:");
22762276

2277-
char hardwareID[11];
2278-
sprintf(hardwareID, "%02X%02X%02X%02X%02X", unitMACAddress[0], unitMACAddress[1], unitMACAddress[2], unitMACAddress[3], unitMACAddress[4]); //Get ready for JSON
2279-
Serial.printf("Device ID: %s\n\r", hardwareID);
2277+
//The MAC address is characters long so we have to split it onto two lines
2278+
char hardwareID[13];
2279+
sprintf(hardwareID, "%02X%02X%02X", unitMACAddress[0], unitMACAddress[1], unitMACAddress[2]);
22802280
String macAddress = String(hardwareID);
22812281

2282-
oled.setFont(QW_FONT_5X7);
2283-
y += fontHeight + 1;
2282+
y += fontHeight;
2283+
textX = x - (oled.getStringWidth(macAddress) / 2);
2284+
oled.setCursor(textX, y);
2285+
oled.print(hardwareID);
2286+
2287+
sprintf(hardwareID, "%02X%02X%02X", unitMACAddress[3], unitMACAddress[4], unitMACAddress[5]);
2288+
macAddress = String(hardwareID);
2289+
2290+
y += fontHeight;
22842291
textX = x - (oled.getStringWidth(macAddress) / 2);
22852292
oled.setCursor(textX, y);
22862293
oled.print(hardwareID);

0 commit comments

Comments
 (0)