Skip to content

Commit 3a4ad32

Browse files
committed
Fix #213
1 parent 71a9c64 commit 3a4ad32

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

Firmware/RTK_Everywhere/Display.ino

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,19 +1717,21 @@ void printTextwithKerning(const char *newText, uint8_t xPos, uint8_t yPos, uint8
17171717
// Show transmission of RTCM correction data packets to NTRIP caster
17181718
void paintRTCM(std::vector<iconPropertyBlinking> *iconList)
17191719
{
1720-
uint8_t xPos = CrossHairProperties.iconDisplay[present.display_type].xPos;
1721-
uint8_t yPos = CrossHairProperties.iconDisplay[present.display_type].yPos;
1722-
17231720
// Determine if the NTRIP Server is casting
17241721
bool casting = false;
17251722
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
17261723
casting |= online.ntripServer[serverIndex];
17271724

1728-
// Note: the "yPos - 1" is potentially brittle. TODO: find a better solution for this
1725+
uint8_t xPos = CrossHairProperties.iconDisplay[present.display_type].xPos;
1726+
uint8_t yPos = CrossHairProperties.iconDisplay[present.display_type].yPos;
1727+
1728+
if (present.display_type == DISPLAY_64x48)
1729+
yPos = yPos - 1; // Move text up by 1 pixel on 64x48. Note: this is brittle. TODO: find a better solution
1730+
17291731
if (casting)
1730-
printTextCenter("Casting", yPos - 1, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
1732+
printTextAt("Casting", xPos + 4, yPos, QW_FONT_8X16, 1); // text, y, font type, kerning
17311733
else
1732-
printTextCenter("Xmitting", yPos - 1, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
1734+
printTextAt("Xmitting", xPos, yPos, QW_FONT_8X16, 1); // text, y, font type, kerning
17331735

17341736
xPos = SIVIconProperties.iconDisplay[present.display_type].xPos;
17351737
yPos = SIVIconProperties.iconDisplay[present.display_type].yPos;
@@ -2635,6 +2637,24 @@ void printTextCenter(const char *text, uint8_t yPos, QwiicFont &fontType, uint8_
26352637
}
26362638
}
26372639

2640+
// Given text, and location, print text to the screen
2641+
void printTextAt(const char *text, uint8_t xPos, uint8_t yPos, QwiicFont &fontType, uint8_t kerning) // text, x, y, font type, kearning, inverted
2642+
{
2643+
oled->setFont(fontType);
2644+
oled->setDrawMode(grROPXOR);
2645+
2646+
uint8_t fontWidth = fontType.width;
2647+
if (fontWidth == 8)
2648+
fontWidth = 7; // 8x16, but widest character is only 7 pixels.
2649+
2650+
for (int x = 0; x < strlen(text); x++)
2651+
{
2652+
oled->setCursor(xPos, yPos);
2653+
oled->print(text[x]);
2654+
xPos += fontWidth + kerning;
2655+
}
2656+
}
2657+
26382658
// Given a message (one or two words) display centered
26392659
void displayMessage(const char *message, uint16_t displayTime)
26402660
{

Firmware/RTK_Everywhere/menuCorrectionsPriorities.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void menuCorrectionsPriorities()
102102
bool validateCorrectionPriorities()
103103
{
104104
// Check priorities have been initialized
105-
// TODO: this should probably be somewhere else. But not sure where...?
106105
if (settings.correctionsSourcesPriority[0] == -1)
107106
return false;
108107

0 commit comments

Comments
 (0)