Skip to content

Commit ae6472d

Browse files
committed
Center text on displays
1 parent fb7a0b8 commit ae6472d

File tree

1 file changed

+16
-41
lines changed

1 file changed

+16
-41
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,61 +1455,36 @@ void printTextwithKerning(const char *newText, uint8_t xPos, uint8_t yPos, uint8
14551455
//Show transmission of RTCM correction data packets to NTRIP caster
14561456
void paintRTCM()
14571457
{
1458-
static uint32_t lastCorrectionDataSeen;
1459-
int textY = 17;
1460-
int textKerning = 8;
1461-
oled.setFont(QW_FONT_8X16);
1458+
int yPos = 17;
14621459
if (bluetoothGetState() != BT_OFF)
1463-
{
1464-
int textX = 1;
1465-
printTextwithKerning("Xmitting", textX, textY, textKerning); //via Bluetooth
1466-
}
1460+
printTextCenter("Xmitting", yPos, QW_FONT_8X16, 1, false); //text, y, font type, kerning, inverted
14671461
else
1468-
{
1469-
int textX = 4;
1470-
printTextwithKerning("Casting", textX, textY, textKerning); //via WiFi
1471-
}
1462+
printTextCenter("Casting", yPos, QW_FONT_8X16, 1, false); //text, y, font type, kerning, inverted
14721463

1473-
//Determine if correction data has been sent recently
1474-
if (bluetoothOutgoingRTCM == true || wifiOutgoingRTCM == true || espnowOutgoingRTCM == true)
1475-
lastCorrectionDataSeen = millis();
1464+
oled.setCursor(0, 39); //x, y
1465+
oled.setFont(QW_FONT_5X7);
1466+
oled.print("RTCM:");
14761467

1477-
if ((millis() - lastCorrectionDataSeen) >= 5000)
1478-
{
1479-
//No correction data seen
1480-
oled.setCursor(0, 33); //x, y
1481-
oled.print("Off");
1482-
}
1468+
if (rtcmPacketsSent < 100)
1469+
oled.setCursor(30, 36); //x, y - Give space for two digits
14831470
else
1484-
{
1485-
oled.setCursor(0, 39); //x, y
1486-
oled.setFont(QW_FONT_5X7);
1487-
oled.print("RTCM:");
1488-
1489-
if (rtcmPacketsSent < 100)
1490-
oled.setCursor(30, 36); //x, y - Give space for two digits
1491-
else
1492-
oled.setCursor(28, 36); //x, y - Push towards colon to make room for log icon
1471+
oled.setCursor(28, 36); //x, y - Push towards colon to make room for log icon
14931472

1494-
oled.setFont(QW_FONT_8X16); //Set font to type 1: 8x16
1495-
oled.print(rtcmPacketsSent); //rtcmPacketsSent is controlled in processRTCM()
1496-
}
1473+
oled.setFont(QW_FONT_8X16); //Set font to type 1: 8x16
1474+
oled.print(rtcmPacketsSent); //rtcmPacketsSent is controlled in processRTCM()
14971475

14981476
paintResets();
14991477
}
15001478

15011479
//Show connecting to NTRIP caster service
15021480
void paintConnectingToNtripCaster()
15031481
{
1504-
int textX = 11;
1505-
int textY = 18;
1506-
int textKerning = 8;
1507-
1508-
printTextwithKerning("Caster", textX, textY, textKerning);
1482+
int yPos = 18;
1483+
printTextCenter("Caster", yPos, QW_FONT_8X16, 1, false); //text, y, font type, kerning, inverted
15091484

1510-
textX = 3;
1511-
textY = 33;
1512-
textKerning = 6;
1485+
int textX = 3;
1486+
int textY = 33;
1487+
int textKerning = 6;
15131488
oled.setFont(QW_FONT_8X16);
15141489

15151490
printTextwithKerning("Connecting", textX, textY, textKerning);

0 commit comments

Comments
 (0)