Remove redundant ST7735_BL variant defs.

No need for _V05 and _V03 definitions - I think there was a slight misunderstanding
on how variant files are supposed to _decrease_ #ifdef code in the cpp files.
This commit is contained in:
Kevin Hester 2024-08-22 08:59:46 -07:00
parent d017fc7a5d
commit 7fb9b094d5
8 changed files with 18 additions and 35 deletions

View File

@ -95,14 +95,8 @@ class LGFX : public lgfx::LGFX_Device
{ {
auto cfg = _light_instance.config(); // Gets a structure for backlight settings. auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
#ifdef ST7735_BL_V03
cfg.pin_bl = ST7735_BL_V03;
#elif defined(ST7735_BL_V05)
cfg.pin_bl = ST7735_BL_V05;
#else
cfg.pin_bl = ST7735_BL; // Pin number to which the backlight is connected cfg.pin_bl = ST7735_BL; // Pin number to which the backlight is connected
#endif cfg.invert = true; // true to invert the brightness of the backlight
cfg.invert = true; // true to invert the brightness of the backlight
// cfg.freq = 44100; // PWM frequency of backlight // cfg.freq = 44100; // PWM frequency of backlight
// cfg.pwm_channel = 1; // PWM channel number to use // cfg.pwm_channel = 1; // PWM channel number to use
@ -581,11 +575,9 @@ void TFTDisplay::sendCommand(uint8_t com)
display(true); display(true);
if (settingsMap[displayBacklight] > 0) if (settingsMap[displayBacklight] > 0)
digitalWrite(settingsMap[displayBacklight], TFT_BACKLIGHT_ON); digitalWrite(settingsMap[displayBacklight], TFT_BACKLIGHT_ON);
#elif defined(ST7735_BL_V03) #elif defined(ST7735_BL)
digitalWrite(ST7735_BL_V03, TFT_BACKLIGHT_ON); pinMode(ST7735_BL, OUTPUT);
#elif defined(ST7735_BL_V05) digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
pinMode(ST7735_BL_V05, OUTPUT);
digitalWrite(ST7735_BL_V05, TFT_BACKLIGHT_ON);
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) #elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
tft->wakeup(); tft->wakeup();
tft->powerSaveOff(); tft->powerSaveOff();
@ -614,11 +606,9 @@ void TFTDisplay::sendCommand(uint8_t com)
tft->clear(); tft->clear();
if (settingsMap[displayBacklight] > 0) if (settingsMap[displayBacklight] > 0)
digitalWrite(settingsMap[displayBacklight], !TFT_BACKLIGHT_ON); digitalWrite(settingsMap[displayBacklight], !TFT_BACKLIGHT_ON);
#elif defined(ST7735_BL_V03) #elif defined(ST7735_BL)
digitalWrite(ST7735_BL_V03, !TFT_BACKLIGHT_ON); pinMode(ST7735_BL, OUTPUT);
#elif defined(ST7735_BL_V05) digitalWrite(ST7735_BL, !TFT_BACKLIGHT_ON);
pinMode(ST7735_BL_V05, OUTPUT);
digitalWrite(ST7735_BL_V05, !TFT_BACKLIGHT_ON);
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) #elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
tft->sleep(); tft->sleep();
tft->powerSaveOn(); tft->powerSaveOn();
@ -720,11 +710,9 @@ bool TFTDisplay::connect()
LOG_INFO("Power to TFT Backlight\n"); LOG_INFO("Power to TFT Backlight\n");
#endif #endif
#ifdef ST7735_BL_V03 #ifdef ST7735_BL
digitalWrite(ST7735_BL_V03, TFT_BACKLIGHT_ON); pinMode(ST7735_BL, OUTPUT);
#elif defined(ST7735_BL_V05) digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
pinMode(ST7735_BL_V05, OUTPUT);
digitalWrite(ST7735_BL_V05, TFT_BACKLIGHT_ON);
#endif #endif
#ifdef UNPHONE #ifdef UNPHONE
unphone.backlight(true); // using unPhone library unphone.backlight(true); // using unPhone library

View File

@ -280,15 +280,11 @@ void setup()
#if defined(VEXT_ENABLE_V03) #if defined(VEXT_ENABLE_V03)
pinMode(VEXT_ENABLE_V03, OUTPUT); pinMode(VEXT_ENABLE_V03, OUTPUT);
pinMode(ST7735_BL_V03, OUTPUT);
digitalWrite(VEXT_ENABLE_V03, 0); // turn on the display power and antenna boost digitalWrite(VEXT_ENABLE_V03, 0); // turn on the display power and antenna boost
digitalWrite(ST7735_BL_V03, 1); // display backligth on
LOG_DEBUG("HELTEC Detect Tracker V1.0\n"); LOG_DEBUG("HELTEC Detect Tracker V1.0\n");
#elif defined(VEXT_ENABLE_V05) #elif defined(VEXT_ENABLE_V05)
pinMode(VEXT_ENABLE_V05, OUTPUT); pinMode(VEXT_ENABLE_V05, OUTPUT);
pinMode(ST7735_BL_V05, OUTPUT);
digitalWrite(VEXT_ENABLE_V05, 1); // turn on the lora antenna boost digitalWrite(VEXT_ENABLE_V05, 1); // turn on the lora antenna boost
digitalWrite(ST7735_BL_V05, 1); // turn on display backligth
LOG_DEBUG("HELTEC Detect Tracker V1.1\n"); LOG_DEBUG("HELTEC Detect Tracker V1.1\n");
#elif defined(VEXT_ENABLE) && defined(VEXT_ON_VALUE) #elif defined(VEXT_ENABLE) && defined(VEXT_ON_VALUE)
pinMode(VEXT_ENABLE, OUTPUT); pinMode(VEXT_ENABLE, OUTPUT);

View File

@ -250,7 +250,6 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
digitalWrite(VEXT_ENABLE_V03, 1); // turn off the display power digitalWrite(VEXT_ENABLE_V03, 1); // turn off the display power
#elif defined(VEXT_ENABLE_V05) #elif defined(VEXT_ENABLE_V05)
digitalWrite(VEXT_ENABLE_V05, 0); // turn off the lora amplifier power digitalWrite(VEXT_ENABLE_V05, 0); // turn off the lora amplifier power
digitalWrite(ST7735_BL_V05, 0); // turn off the display power
#elif defined(VEXT_ENABLE) && defined(VEXT_ON_VALUE) #elif defined(VEXT_ENABLE) && defined(VEXT_ON_VALUE)
digitalWrite(VEXT_ENABLE, !VEXT_ON_VALUE); // turn on the display power digitalWrite(VEXT_ENABLE, !VEXT_ON_VALUE); // turn on the display power
#elif defined(VEXT_ENABLE) #elif defined(VEXT_ENABLE)

View File

@ -15,7 +15,7 @@
#define ST7735_RESET 39 #define ST7735_RESET 39
#define ST7735_MISO -1 #define ST7735_MISO -1
#define ST7735_BUSY -1 #define ST7735_BUSY -1
#define ST7735_BL_V05 21 /* V1.1 PCB marking */ #define ST7735_BL 21 /* V1.1 PCB marking */
#define ST7735_SPI_HOST SPI3_HOST #define ST7735_SPI_HOST SPI3_HOST
#define SPI_FREQUENCY 40000000 #define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000 #define SPI_READ_FREQUENCY 16000000

View File

@ -15,7 +15,7 @@
#define ST7735_RESET 39 #define ST7735_RESET 39
#define ST7735_MISO -1 #define ST7735_MISO -1
#define ST7735_BUSY -1 #define ST7735_BUSY -1
#define ST7735_BL_V03 45 #define ST7735_BL 45
#define ST7735_SPI_HOST SPI3_HOST #define ST7735_SPI_HOST SPI3_HOST
#define SPI_FREQUENCY 40000000 #define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000 #define SPI_READ_FREQUENCY 16000000

View File

@ -17,7 +17,7 @@
#define ST7735_RESET 39 #define ST7735_RESET 39
#define ST7735_MISO -1 #define ST7735_MISO -1
#define ST7735_BUSY -1 #define ST7735_BUSY -1
#define ST7735_BL_V05 21 /* V1.1 PCB marking */ #define ST7735_BL 21 /* V1.1 PCB marking */
#define ST7735_SPI_HOST SPI3_HOST #define ST7735_SPI_HOST SPI3_HOST
#define SPI_FREQUENCY 40000000 #define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000 #define SPI_READ_FREQUENCY 16000000

View File

@ -16,7 +16,7 @@
#define ST7789_CS 38 #define ST7789_CS 38
#define ST7789_RS 40 #define ST7789_RS 40
#define ST7789_BL 21 #define ST7789_BL 21
// P#define ST7735_BL_V05 21 /* V1.1 PCB marking */ // P#define ST7735_BL 21 /* V1.1 PCB marking */
#define ST7789_RESET -1 #define ST7789_RESET -1
#define ST7789_MISO -1 #define ST7789_MISO -1
@ -41,7 +41,7 @@
// #define ST7735_RESET 39 // #define ST7735_RESET 39
// #define ST7735_MISO -1 // #define ST7735_MISO -1
// #define ST7735_BUSY -1 // #define ST7735_BUSY -1
#define ST7735_BL_V05 21 /* V1.1 PCB marking */ #define ST7735_BL 21 /* V1.1 PCB marking */
// #define ST7735_SPI_HOST SPI3_HOST // #define ST7735_SPI_HOST SPI3_HOST
// #define SPI_FREQUENCY 40000000 // #define SPI_FREQUENCY 40000000
// #define SPI_READ_FREQUENCY 16000000 // #define SPI_READ_FREQUENCY 16000000

View File

@ -19,7 +19,7 @@
// #define ST7735_RESET 39 // #define ST7735_RESET 39
// #define ST7735_MISO -1 // #define ST7735_MISO -1
// #define ST7735_BUSY -1 // #define ST7735_BUSY -1
#define ST7735_BL_V05 21 /* V1.1 PCB marking */ #define ST7735_BL 21 /* V1.1 PCB marking */
// #define ST7735_SPI_HOST SPI3_HOST // #define ST7735_SPI_HOST SPI3_HOST
// #define SPI_FREQUENCY 40000000 // #define SPI_FREQUENCY 40000000
// #define SPI_READ_FREQUENCY 16000000 // #define SPI_READ_FREQUENCY 16000000