diff --git a/src/display.cpp b/src/display.cpp index b4104dc..455570c 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -6,6 +6,8 @@ #include "display.h" #include "TimeLib.h" +String currentSymbol, lastSymbol; + #ifdef HAS_TFT #include @@ -163,6 +165,7 @@ void displayToggle(bool toggle) { void displayShow(const String& header, const String& line1, const String& line2, int wait) { #ifdef HAS_TFT + String filledHeader = fillStringLength(header, 11); String filledLine1 = fillStringLength(line1, 22); String filledLine2 = fillStringLength(line2, 22); const String* const lines[] = {&filledLine1, &filledLine2}; @@ -171,7 +174,7 @@ void displayShow(const String& header, const String& line1, const String& line2, tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(bigSizeFont); tft.setCursor(0, 0); - tft.print(header); + tft.print(filledHeader); tft.setTextSize(smallSizeFont); for (int i = 0; i < 2; i++) { tft.setCursor(0, ((lineSpacing * (2 + i)) - 2)); @@ -207,11 +210,12 @@ void displayShow(const String& header, const String& line1, const String& line2, void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, int wait) { #ifdef HAS_TFT - String filledLine1 = fillStringLength(line1, 22); - String filledLine2 = fillStringLength(line2, 22); - String filledLine3 = fillStringLength(line3, 22); - String filledLine4 = fillStringLength(line4, 22); - String filledLine5 = fillStringLength(line5, 22); + String filledHeader = fillStringLength(header, 11); + String filledLine1 = fillStringLength(line1, 22); + String filledLine2 = fillStringLength(line2, 22); + String filledLine3 = fillStringLength(line3, 22); + String filledLine4 = fillStringLength(line4, 22); + String filledLine5 = fillStringLength(line5, 22); const String* const lines[] = {&filledLine1, &filledLine2, &filledLine3, &filledLine4, &filledLine5}; if (menuDisplay != lastMenuDisplay) { @@ -222,7 +226,7 @@ void displayShow(const String& header, const String& line1, const String& line2, tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(bigSizeFont); tft.setCursor(0, 0); - tft.print(header); + tft.print(filledHeader); tft.setTextSize(smallSizeFont); for (int i = 0; i < 5; i++) { tft.setCursor(0, ((lineSpacing * (2 + i)) - 2)); @@ -244,11 +248,17 @@ void displayShow(const String& header, const String& line1, const String& line2, * If bluetooth is disconnected or if we are in the first part of the clock, then we show the APRS symbol * Otherwise, we are in the second part of the clock, then we show BT connected */ + const auto time_now = now(); if (!bluetoothConnected || time_now % 10 < 5) { if (symbolAvailable) { + currentSymbol = symbolArray[symbol]; #if HELTEC_WIRELESS_TRACKER + if (currentSymbol != lastSymbol) { + tft.fillRect((TFT_WIDTH - SYMBOL_WIDTH + (128 - TFT_WIDTH)), 0, SYMBOL_WIDTH, SYMBOL_HEIGHT, TFT_BLACK); + } tft.drawBitmap((TFT_WIDTH - SYMBOL_WIDTH + (128 - TFT_WIDTH)), 0, symbolsAPRS[symbol], SYMBOL_WIDTH, SYMBOL_HEIGHT, TFT_WHITE);//, TFT_RED); + lastSymbol = currentSymbol; #endif #if TTGO_T_DECK_GPS tft.drawBitmap((TFT_WIDTH - SYMBOL_WIDTH), 0, symbolsAPRS[symbol], SYMBOL_WIDTH, SYMBOL_HEIGHT, TFT_WHITE);//, TFT_RED); @@ -297,8 +307,6 @@ void displayShow(const String& header, const String& line1, const String& line2, } } - //tft.fillRect(20, 0, bufferWidth, bufferHeight, TFT_BLACK); // Replace TFT_BLA - symbolAvailable = symbol != 100; /*