@@ -1717,19 +1717,21 @@ void printTextwithKerning(const char *newText, uint8_t xPos, uint8_t yPos, uint8
1717
1717
// Show transmission of RTCM correction data packets to NTRIP caster
1718
1718
void paintRTCM (std::vector<iconPropertyBlinking> *iconList)
1719
1719
{
1720
- uint8_t xPos = CrossHairProperties.iconDisplay [present.display_type ].xPos ;
1721
- uint8_t yPos = CrossHairProperties.iconDisplay [present.display_type ].yPos ;
1722
-
1723
1720
// Determine if the NTRIP Server is casting
1724
1721
bool casting = false ;
1725
1722
for (int serverIndex = 0 ; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
1726
1723
casting |= online.ntripServer [serverIndex];
1727
1724
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
+
1729
1731
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
1731
1733
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
1733
1735
1734
1736
xPos = SIVIconProperties.iconDisplay [present.display_type ].xPos ;
1735
1737
yPos = SIVIconProperties.iconDisplay [present.display_type ].yPos ;
@@ -2635,6 +2637,24 @@ void printTextCenter(const char *text, uint8_t yPos, QwiicFont &fontType, uint8_
2635
2637
}
2636
2638
}
2637
2639
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
+
2638
2658
// Given a message (one or two words) display centered
2639
2659
void displayMessage (const char *message, uint16_t displayTime)
2640
2660
{
0 commit comments