Skip to content

Commit 46aef03

Browse files
committed
TFT brightness corrections
1 parent b4f57c1 commit 46aef03

13 files changed

Lines changed: 121 additions & 107 deletions

File tree

src/LoRa_APRS_Tracker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TinyGPSPlus gps;
5757
BluetoothSerial SerialBT;
5858
#endif
5959

60-
String versionDate = "2025.03.06";
60+
String versionDate = "2025.03.07";
6161

6262
uint8_t myBeaconsIndex = 0;
6363
int myBeaconsSize = Config.beacons.size();
@@ -109,7 +109,7 @@ extern bool gpsIsActive;
109109

110110
void setup() {
111111
Serial.begin(115200);
112-
112+
113113
#ifndef DEBUG
114114
logger.setDebugLevel(logging::LoggerLevel::LOGGER_LEVEL_INFO);
115115
#endif

src/display.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const uint8_t *symbolsAPRS[] = {runnerSymbol, carSymbol, jeepSymbol, bikeSymbol
8080
//#define OLED_DISPLAY_HAS_RST_PIN
8181

8282
int lastMenuDisplay = 0;
83-
uint8_t screenBrightness = 1; //from 1 to 255 to regulate brightness of oled scren
83+
uint8_t screenBrightness = 1; //from 1 to 255 to regulate brightness of screens
8484
bool symbolAvailable = true;
8585

8686
extern logging::Logger logger;
@@ -155,7 +155,6 @@ extern logging::Logger logger;
155155
sprite.fillRect(0, 60, 320, 2, greyColorDark);
156156
}
157157

158-
159158
void draw_T_DECK_MenuButtons(int menu) {
160159
int ladoCuadrado = 45;
161160
int curvaCuadrado = 8;
@@ -460,7 +459,6 @@ void displayShow(const String& header, const String& line1, const String& line2,
460459
delay(wait);
461460
}
462461

463-
464462
void drawSymbol(int symbolIndex, bool bluetoothActive) {
465463
const uint8_t *bitMap = symbolsAPRS[symbolIndex];
466464
#ifdef HAS_TFT
@@ -476,7 +474,6 @@ void drawSymbol(int symbolIndex, bool bluetoothActive) {
476474
#endif
477475
}
478476

479-
480477
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, int wait) {
481478
#ifdef HAS_TFT
482479
#if defined(TTGO_T_DECK_GPS) || defined(TTGO_T_DECK_PLUS)

src/keyboard_utils.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,26 @@ namespace KEYBOARD_Utils {
332332
menuDisplay = 2210;
333333
} else if (menuDisplay >= 2210 && menuDisplay <= 2212) {
334334
switch (menuDisplay) {
335-
case 2210:
336-
screenBrightness = 1;
335+
case 2210: // low
336+
#ifdef HAS_TFT
337+
screenBrightness = 70;
338+
#else
339+
screenBrightness = 1;
340+
#endif
337341
break;
338-
case 2211:
339-
screenBrightness = 40;
342+
case 2211: // mid
343+
#ifdef HAS_TFT
344+
screenBrightness = 150;
345+
#else
346+
screenBrightness = 40;
347+
#endif
340348
break;
341-
case 2212:
349+
case 2212: // max
342350
screenBrightness = 255;
343351
break;
344352
default:
345353
#ifdef HAS_TFT
346-
screenBrightness = 40;
354+
screenBrightness = 255;
347355
#else
348356
screenBrightness = 1;
349357
#endif

src/menu_utils.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,23 @@ namespace MENU_Utils {
8181
}
8282

8383
const String screenBrightnessAsString(const uint8_t bright) {
84-
if (bright == 255) {
85-
return "Max";
86-
} else if (bright == 1) {
87-
return "Low";
88-
} else {
89-
return "Mid";
90-
}
84+
#ifdef HAS_TFT
85+
if (bright == 255) {
86+
return "Max";
87+
} else if (bright == 70) {
88+
return "Low";
89+
} else {
90+
return "Mid";
91+
}
92+
#else
93+
if (bright == 255) {
94+
return "Max";
95+
} else if (bright == 1) {
96+
return "Low";
97+
} else {
98+
return "Mid";
99+
}
100+
#endif
91101
}
92102

93103
void showOnScreen() {

src/station_utils.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -349,41 +349,40 @@ namespace STATION_Utils {
349349
default: return; // Invalid type, exit function
350350
}
351351

352-
File fileIndex = SPIFFS.open(filePath);
353-
if (!fileIndex) {
352+
if (!SPIFFS.exists(filePath)) {
354353
switch (type) {
355354
case 0: myBeaconsIndex = 0; break;
356355
case 1: loraIndex = 0; break;
357-
case 2:
356+
case 2:
358357
#ifdef HAS_TFT
359-
screenBrightness = 40;
358+
screenBrightness = 255;
360359
#else
361360
screenBrightness = 1;
362361
#endif
363362
break;
364363
default: return; // Invalid type, exit function
365364
}
366365
return;
366+
} else {
367+
File fileIndex = SPIFFS.open(filePath, "r");
368+
while (fileIndex.available()) {
369+
String firstLine = fileIndex.readStringUntil('\n');
370+
int index = firstLine.toInt();
371+
String logMessage;
372+
if (type == 0) {
373+
myBeaconsIndex = index;
374+
logMessage = "Callsign Index:";
375+
} else if (type == 1) {
376+
loraIndex = index;
377+
logMessage = "LoRa Freq Index:";
378+
} else {
379+
screenBrightness = index;
380+
logMessage = "Brightness:";
381+
}
382+
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Main", "%s %s", logMessage.c_str(), firstLine);
383+
}
384+
fileIndex.close();
367385
}
368-
369-
while (fileIndex.available()) {
370-
String firstLine = fileIndex.readStringUntil('\n');
371-
int index = firstLine.toInt();
372-
String logMessage;
373-
if (type == 0) {
374-
myBeaconsIndex = index;
375-
logMessage = "Callsign Index:";
376-
} else if (type == 1) {
377-
loraIndex = index;
378-
logMessage = "LoRa Freq Index:";
379-
} else {
380-
screenBrightness = index;
381-
logMessage = "Brightness:";
382-
}
383-
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Main", "%s %s", logMessage.c_str(), firstLine);
384-
}
385-
386-
fileIndex.close();
387386
}
388387

389388
}

variants/ESP32_DIY_1W_LoRa_GPS_LLCC68/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extends = env:esp32
33
board = esp32dev
44
build_flags =
55
${common.build_flags}
6-
-D ESP32_DIY_1W_LoRa_GPS_LLCC68
6+
-D ESP32_DIY_1W_LoRa_GPS_LLCC68
77
lib_deps =
88
${common.lib_deps}
99
${common.display_libs}

variants/F4GOH_1W_LoRa_Tracker/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extends = env:esp32
33
board = esp32dev
44
build_flags =
55
${common.build_flags}
6-
-D F4GOH_1W_LoRa_Tracker
6+
-D F4GOH_1W_LoRa_Tracker
77
lib_deps =
88
${common.lib_deps}
99
${common.display_libs}

variants/Wemos_ESP32_Bat_LoRa_GPS/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extends = env:esp32
33
board = esp32dev
44
build_flags =
55
${common.build_flags}
6-
-D WEMOS_ESP32_Bat_LoRa_GPS
6+
-D WEMOS_ESP32_Bat_LoRa_GPS
77
lib_deps =
88
${common.lib_deps}
99
${common.display_libs}

variants/heltec_wireless_tracker/platformio.ini

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ build_flags =
66
${common.build_flags}
77
${common.usb_flags}
88
-D HELTEC_WIRELESS_TRACKER
9-
-D USER_SETUP_LOADED
9+
-D USER_SETUP_LOADED
1010
-D TFT_WIDTH=80
1111
-D TFT_HEIGHT=160
12-
-D ST7735_DRIVER
13-
-D ST7735_GREENTAB160x80
14-
-D TFT_RGB_ORDER=TFT_BGR
15-
-D TFT_MOSI=42
16-
-D TFT_SCLK=41
17-
-D TFT_CS=38
18-
-D TFT_DC=40
19-
-D TFT_RST=39
12+
-D ST7735_DRIVER
13+
-D ST7735_GREENTAB160x80
14+
-D TFT_RGB_ORDER=TFT_BGR
15+
-D TFT_MOSI=42
16+
-D TFT_SCLK=41
17+
-D TFT_CS=38
18+
-D TFT_DC=40
19+
-D TFT_RST=39
2020
-D TFT_BL=21
2121
-D TFT_BACKLIGHT_ON=1
22-
-D TOUCH_CS=-1
23-
-D LOAD_GLCD
24-
-D LOAD_FONT2
25-
-D LOAD_FONT4
26-
-D LOAD_FONT6
27-
-D LOAD_FONT7
28-
-D LOAD_FONT8
29-
-D SPI_FREQUENCY=27000000
30-
-D USE_HSPI_PORT
22+
-D TOUCH_CS=-1
23+
-D LOAD_GLCD
24+
-D LOAD_FONT2
25+
-D LOAD_FONT4
26+
-D LOAD_FONT6
27+
-D LOAD_FONT7
28+
-D LOAD_FONT8
29+
-D SPI_FREQUENCY=27000000
30+
-D USE_HSPI_PORT
3131
lib_deps =
3232
${common.lib_deps}
3333
bodmer/TFT_eSPI @ 2.5.43

variants/ttgo-t-lora32-v2_1_GPS_915/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ build_flags =
77
lib_deps =
88
${common.lib_deps}
99
${common.display_libs}
10-
adafruit/Adafruit SH110X @ 2.1.10
10+
adafruit/Adafruit SH110X @ 2.1.10

0 commit comments

Comments
 (0)