tdeck ready
This commit is contained in:
parent
3acf73bf5f
commit
100b002309
|
|
@ -53,6 +53,10 @@ jobs:
|
||||||
chip: esp32
|
chip: esp32
|
||||||
- name: ttgo-t-beam-v1_2_SX1262
|
- name: ttgo-t-beam-v1_2_SX1262
|
||||||
chip: esp32
|
chip: esp32
|
||||||
|
- name: ttgo_t_deck_plus
|
||||||
|
chip: esp32s3
|
||||||
|
- name: ttgo_t_deck_GPS
|
||||||
|
chip: esp32s3
|
||||||
- name: ESP32_DIY_LoRa_A7670
|
- name: ESP32_DIY_LoRa_A7670
|
||||||
chip: esp32
|
chip: esp32
|
||||||
- name: ESP32_DIY_LoRa_A7670_915
|
- name: ESP32_DIY_LoRa_A7670_915
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,9 @@
|
||||||
|
|
||||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
||||||
|
|
||||||
|
|
||||||
void cleanTFT();
|
|
||||||
void displaySetup();
|
void displaySetup();
|
||||||
void displayToggle(bool toggle);
|
void displayToggle(bool toggle);
|
||||||
|
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3);
|
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6);
|
|
||||||
|
|
||||||
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait = 0);
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait = 0);
|
||||||
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait = 0);
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait = 0);
|
||||||
|
|
||||||
|
|
|
||||||
102
src/display.cpp
102
src/display.cpp
|
|
@ -9,6 +9,7 @@
|
||||||
#include <TFT_eSPI.h>
|
#include <TFT_eSPI.h>
|
||||||
|
|
||||||
TFT_eSPI tft = TFT_eSPI();
|
TFT_eSPI tft = TFT_eSPI();
|
||||||
|
TFT_eSprite sprite = TFT_eSprite(&tft);
|
||||||
|
|
||||||
#ifdef HELTEC_WIRELESS_TRACKER
|
#ifdef HELTEC_WIRELESS_TRACKER
|
||||||
#define bigSizeFont 2
|
#define bigSizeFont 2
|
||||||
|
|
@ -18,8 +19,9 @@
|
||||||
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)
|
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)
|
||||||
#define bigSizeFont 5
|
#define bigSizeFont 5
|
||||||
#define smallSizeFont 2
|
#define smallSizeFont 2
|
||||||
#define lineSpacing 22
|
#define lineSpacing 25
|
||||||
#endif
|
#endif
|
||||||
|
uint16_t redColor = 0xc8a2;
|
||||||
#else
|
#else
|
||||||
#ifdef HAS_EPAPER
|
#ifdef HAS_EPAPER
|
||||||
//
|
//
|
||||||
|
|
@ -37,16 +39,8 @@
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
|
|
||||||
String oldHeader, oldFirstLine, oldSecondLine, oldThirdLine, oldFourthLine, oldFifthLine, oldSixthLine;
|
|
||||||
bool displayFound = false;
|
bool displayFound = false;
|
||||||
|
|
||||||
|
|
||||||
void cleanTFT() {
|
|
||||||
#ifdef HAS_TFT
|
|
||||||
tft.fillScreen(TFT_BLACK);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void displaySetup() {
|
void displaySetup() {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
@ -58,8 +52,15 @@ void displaySetup() {
|
||||||
} else {
|
} else {
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
}
|
}
|
||||||
|
pinMode(TFT_BL, OUTPUT);
|
||||||
|
digitalWrite(TFT_BL, HIGH);
|
||||||
tft.setTextFont(0);
|
tft.setTextFont(0);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)
|
||||||
|
sprite.createSprite(320,240);
|
||||||
|
#else
|
||||||
|
sprite.createSprite(160,80);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef HAS_EPAPER
|
#ifdef HAS_EPAPER
|
||||||
//
|
//
|
||||||
|
|
@ -114,49 +115,30 @@ void displayToggle(bool toggle) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3) {
|
|
||||||
if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3) {
|
|
||||||
oldHeader = header;
|
|
||||||
oldFirstLine = line1;
|
|
||||||
oldSecondLine = line2;
|
|
||||||
oldThirdLine = line3;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6) {
|
|
||||||
if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3 || oldFourthLine != line4 || oldFifthLine != line5 || oldSixthLine != line6) {
|
|
||||||
oldHeader = header;
|
|
||||||
oldFirstLine = line1;
|
|
||||||
oldSecondLine = line2;
|
|
||||||
oldThirdLine = line3;
|
|
||||||
oldFourthLine = line4;
|
|
||||||
oldFifthLine = line5;
|
|
||||||
oldSixthLine = line6;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait) {
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait) {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
const String* const lines[] = {&line1, &line2, &line3};
|
const String* const lines[] = {&line1, &line2, &line3};
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
if (shouldCleanTFT(header, line1, line2, line3)) {
|
sprite.fillSprite(TFT_BLACK);
|
||||||
cleanTFT();
|
#if defined(HELTEC_WIRELESS_TRACKER)
|
||||||
}
|
sprite.fillRect(0, 0, 160, 19, redColor);
|
||||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
#endif
|
||||||
tft.setTextSize(bigSizeFont);
|
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)
|
||||||
tft.setCursor(0, 0);
|
sprite.fillRect(0, 0, 320, 43, redColor);
|
||||||
tft.print(header);
|
#endif
|
||||||
tft.setTextSize(smallSizeFont);
|
sprite.setTextFont(0);
|
||||||
|
sprite.setTextSize(bigSizeFont);
|
||||||
|
sprite.setTextColor(TFT_WHITE, redColor);
|
||||||
|
sprite.drawString(header, 3, 3);
|
||||||
|
|
||||||
|
sprite.setTextSize(smallSizeFont);
|
||||||
|
sprite.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
tft.setCursor(0, ((lineSpacing * (2 + i)) - 2));
|
sprite.drawString(*lines[i], 3, (lineSpacing * (2 + i)) - 2);
|
||||||
tft.print(*lines[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprite.pushSprite(0,0);
|
||||||
#else
|
#else
|
||||||
#ifdef HAS_EPAPER
|
#ifdef HAS_EPAPER
|
||||||
// ... to be continued
|
// ... to be continued
|
||||||
|
|
@ -185,18 +167,26 @@ void displayShow(const String& header, const String& line1, const String& line2,
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
const String* const lines[] = {&line1, &line2, &line3, &line4, &line5, &line6};
|
const String* const lines[] = {&line1, &line2, &line3, &line4, &line5, &line6};
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
if (shouldCleanTFT(header, line1, line2, line3, line4, line5, line6)) {
|
sprite.fillSprite(TFT_BLACK);
|
||||||
cleanTFT();
|
#if defined(HELTEC_WIRELESS_TRACKER)
|
||||||
}
|
sprite.fillRect(0, 0, 160, 19, redColor);
|
||||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
#endif
|
||||||
tft.setTextSize(bigSizeFont);
|
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)
|
||||||
tft.setCursor(0, 0);
|
sprite.fillRect(0, 0, 320, 43, redColor);
|
||||||
tft.print(header);
|
#endif
|
||||||
tft.setTextSize(smallSizeFont);
|
sprite.setTextFont(0);
|
||||||
|
sprite.setTextSize(bigSizeFont);
|
||||||
|
sprite.setTextColor(TFT_WHITE, redColor);
|
||||||
|
sprite.drawString(header, 3, 3);
|
||||||
|
|
||||||
|
sprite.setTextSize(smallSizeFont);
|
||||||
|
sprite.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
tft.setCursor(0, ((lineSpacing * (2 + i)) - 2));
|
sprite.drawString(*lines[i], 3, (lineSpacing * (2 + i)) - 2);
|
||||||
tft.print(*lines[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprite.pushSprite(0,0);
|
||||||
#else
|
#else
|
||||||
#ifdef HAS_EPAPER
|
#ifdef HAS_EPAPER
|
||||||
// ... to be continued
|
// ... to be continued
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue