From 0feedbec2e40715c224733a9cf64c70285ae696b Mon Sep 17 00:00:00 2001 From: agessaman Date: Sun, 23 Aug 2026 15:43:22 -0700 Subject: [PATCH] fix(boards): reset Heltec V4 R8 TFT on GPIO 21 GPIO 21 is the Expansion Kit V2 panel reset, not touch reset. Leaving RST unwired left the ST7789 blank after a bogus touch pulse. --- src/helpers/ui/ST7789LCDDisplay.cpp | 24 +++++++++++++++-------- variants/heltec_v4_r8/HeltecV4R8Board.cpp | 2 ++ variants/heltec_v4_r8/platformio.ini | 3 +-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/helpers/ui/ST7789LCDDisplay.cpp b/src/helpers/ui/ST7789LCDDisplay.cpp index a9f30dd5..6e0862c3 100644 --- a/src/helpers/ui/ST7789LCDDisplay.cpp +++ b/src/helpers/ui/ST7789LCDDisplay.cpp @@ -4,6 +4,10 @@ #define PIN_TFT_MISO -1 #endif +#ifndef PIN_TFT_LEDA_CTL_ACTIVE + #define PIN_TFT_LEDA_CTL_ACTIVE HIGH +#endif + #ifndef DISPLAY_ROTATION #define DISPLAY_ROTATION 3 #endif @@ -36,11 +40,14 @@ ColorVal UIColor::corp_blue = 0x001A; bool ST7789LCDDisplay::begin() { if (!_isOn) { - if (_peripher_power) _peripher_power->claim(); + if (_peripher_power) { + _peripher_power->claim(); + delay(100); + } if (PIN_TFT_LEDA_CTL != -1) { pinMode(PIN_TFT_LEDA_CTL, OUTPUT); - digitalWrite(PIN_TFT_LEDA_CTL, HIGH); + digitalWrite(PIN_TFT_LEDA_CTL, !PIN_TFT_LEDA_CTL_ACTIVE); } // Im not sure if this is just a t-deck problem or not, if your display is slow try this. @@ -55,9 +62,13 @@ bool ST7789LCDDisplay::begin() { display.fillScreen(ST77XX_BLACK); display.setTextColor(ST77XX_WHITE); - display.setTextSize(2 * DISPLAY_SCALE_X); + display.setTextSize(2 * DISPLAY_SCALE_X); display.cp437(true); // Use full 256 char 'Code Page 437' font - + + if (PIN_TFT_LEDA_CTL != -1) { + digitalWrite(PIN_TFT_LEDA_CTL, PIN_TFT_LEDA_CTL_ACTIVE); + } + _isOn = true; } @@ -71,14 +82,11 @@ void ST7789LCDDisplay::turnOn() { void ST7789LCDDisplay::turnOff() { if (_isOn) { if (PIN_TFT_LEDA_CTL != -1) { - digitalWrite(PIN_TFT_LEDA_CTL, HIGH); + digitalWrite(PIN_TFT_LEDA_CTL, !PIN_TFT_LEDA_CTL_ACTIVE); } if (PIN_TFT_RST != -1) { digitalWrite(PIN_TFT_RST, LOW); } - if (PIN_TFT_LEDA_CTL != -1) { - digitalWrite(PIN_TFT_LEDA_CTL, LOW); - } _isOn = false; if (_peripher_power) _peripher_power->release(); diff --git a/variants/heltec_v4_r8/HeltecV4R8Board.cpp b/variants/heltec_v4_r8/HeltecV4R8Board.cpp index 11aa9f64..580662b3 100644 --- a/variants/heltec_v4_r8/HeltecV4R8Board.cpp +++ b/variants/heltec_v4_r8/HeltecV4R8Board.cpp @@ -8,6 +8,8 @@ void HeltecV4R8Board::begin() { loRaFEMControl.init(); + // Expansion Kit CHSC6X touch RST/INT are unwired. GPIO 21 is TFT RST + // (PIN_TFT_RST), owned by ST7789LCDDisplay. Do not pulse it here. #ifdef PIN_TOUCH_RST pinMode(PIN_TOUCH_RST, OUTPUT); digitalWrite(PIN_TOUCH_RST, HIGH); diff --git a/variants/heltec_v4_r8/platformio.ini b/variants/heltec_v4_r8/platformio.ini index 95fa3a2e..ea788e10 100644 --- a/variants/heltec_v4_r8/platformio.ini +++ b/variants/heltec_v4_r8/platformio.ini @@ -65,7 +65,7 @@ build_flags = -D PIN_BOARD_SCL=18 -D DISPLAY_SCALE_X=2.5 -D DISPLAY_SCALE_Y=3.75 - -D PIN_TFT_RST=-1 + -D PIN_TFT_RST=21 -D PIN_TFT_VDD_CTL=-1 -D PIN_TFT_LEDA_CTL=44 -D PIN_TFT_LEDA_CTL_ACTIVE=HIGH @@ -75,7 +75,6 @@ build_flags = -D PIN_TFT_SDA=15 -D PIN_TFT_MISO=45 -D PIN_BUZZER=4 - -D PIN_TOUCH_RST=21 build_src_filter = ${Heltec_v4_r8.build_src_filter} + lib_deps =