tft symbol fix
This commit is contained in:
parent
dd2e778228
commit
2e56d14799
|
|
@ -6,6 +6,8 @@
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "TimeLib.h"
|
#include "TimeLib.h"
|
||||||
|
|
||||||
|
String currentSymbol, lastSymbol;
|
||||||
|
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
#include <TFT_eSPI.h>
|
#include <TFT_eSPI.h>
|
||||||
|
|
||||||
|
|
@ -163,6 +165,7 @@ void displayToggle(bool toggle) {
|
||||||
|
|
||||||
void displayShow(const String& header, const String& line1, const String& line2, int wait) {
|
void displayShow(const String& header, const String& line1, const String& line2, int wait) {
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
|
String filledHeader = fillStringLength(header, 11);
|
||||||
String filledLine1 = fillStringLength(line1, 22);
|
String filledLine1 = fillStringLength(line1, 22);
|
||||||
String filledLine2 = fillStringLength(line2, 22);
|
String filledLine2 = fillStringLength(line2, 22);
|
||||||
const String* const lines[] = {&filledLine1, &filledLine2};
|
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.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||||
tft.setTextSize(bigSizeFont);
|
tft.setTextSize(bigSizeFont);
|
||||||
tft.setCursor(0, 0);
|
tft.setCursor(0, 0);
|
||||||
tft.print(header);
|
tft.print(filledHeader);
|
||||||
tft.setTextSize(smallSizeFont);
|
tft.setTextSize(smallSizeFont);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
tft.setCursor(0, ((lineSpacing * (2 + i)) - 2));
|
tft.setCursor(0, ((lineSpacing * (2 + i)) - 2));
|
||||||
|
|
@ -207,6 +210,7 @@ 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) {
|
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
|
#ifdef HAS_TFT
|
||||||
|
String filledHeader = fillStringLength(header, 11);
|
||||||
String filledLine1 = fillStringLength(line1, 22);
|
String filledLine1 = fillStringLength(line1, 22);
|
||||||
String filledLine2 = fillStringLength(line2, 22);
|
String filledLine2 = fillStringLength(line2, 22);
|
||||||
String filledLine3 = fillStringLength(line3, 22);
|
String filledLine3 = fillStringLength(line3, 22);
|
||||||
|
|
@ -222,7 +226,7 @@ void displayShow(const String& header, const String& line1, const String& line2,
|
||||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||||
tft.setTextSize(bigSizeFont);
|
tft.setTextSize(bigSizeFont);
|
||||||
tft.setCursor(0, 0);
|
tft.setCursor(0, 0);
|
||||||
tft.print(header);
|
tft.print(filledHeader);
|
||||||
tft.setTextSize(smallSizeFont);
|
tft.setTextSize(smallSizeFont);
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
tft.setCursor(0, ((lineSpacing * (2 + i)) - 2));
|
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
|
* 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
|
* Otherwise, we are in the second part of the clock, then we show BT connected
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const auto time_now = now();
|
const auto time_now = now();
|
||||||
if (!bluetoothConnected || time_now % 10 < 5) {
|
if (!bluetoothConnected || time_now % 10 < 5) {
|
||||||
if (symbolAvailable) {
|
if (symbolAvailable) {
|
||||||
|
currentSymbol = symbolArray[symbol];
|
||||||
#if HELTEC_WIRELESS_TRACKER
|
#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);
|
tft.drawBitmap((TFT_WIDTH - SYMBOL_WIDTH + (128 - TFT_WIDTH)), 0, symbolsAPRS[symbol], SYMBOL_WIDTH, SYMBOL_HEIGHT, TFT_WHITE);//, TFT_RED);
|
||||||
|
lastSymbol = currentSymbol;
|
||||||
#endif
|
#endif
|
||||||
#if TTGO_T_DECK_GPS
|
#if TTGO_T_DECK_GPS
|
||||||
tft.drawBitmap((TFT_WIDTH - SYMBOL_WIDTH), 0, symbolsAPRS[symbol], SYMBOL_WIDTH, SYMBOL_HEIGHT, TFT_WHITE);//, TFT_RED);
|
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;
|
symbolAvailable = symbol != 100;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue