LilyGo T5 S3 Epaper Pro No GPS version implementation stage 1 - H752-B; set backlight double click boot to 153 full brightness on, triple click to 40 brightness, double click off

This commit is contained in:
pelgraine
2026-03-11 20:56:27 +11:00
parent 9b15458927
commit 479673e90f
17 changed files with 1507 additions and 15 deletions
+33
View File
@@ -4,6 +4,10 @@
#include <Mesh.h>
#include "RadioPresets.h" // Shared radio presets (serial CLI + settings screen)
#if defined(LilyGo_T5S3_EPaper_Pro)
#include "target.h" // for board.setBacklight() CLI command
#endif
#ifdef HAS_4G_MODEM
#include "ModemManager.h" // Serial CLI modem commands
#endif
@@ -2662,6 +2666,30 @@ void MyMesh::checkCLIRescueCmd() {
Serial.println(" Error: use 0 (default), 4800, 9600, 19200, 38400, 57600, or 115200");
}
// Backlight control (T5S3 E-Paper Pro only)
} else if (memcmp(config, "backlight ", 10) == 0) {
#if defined(LilyGo_T5S3_EPaper_Pro)
const char* val = &config[10];
if (strcmp(val, "on") == 0) {
board.setBacklight(true);
Serial.println(" > backlight ON");
} else if (strcmp(val, "off") == 0) {
board.setBacklight(false);
Serial.println(" > backlight OFF");
} else {
int brightness = atoi(val);
if (brightness >= 0 && brightness <= 255) {
board.setBacklightBrightness((uint8_t)brightness);
board.setBacklight(brightness > 0);
Serial.printf(" > backlight brightness = %d\n", brightness);
} else {
Serial.println(" Error: use 'on', 'off', or 0-255");
}
}
#else
Serial.println(" Error: backlight not available on this device");
#endif
} else {
Serial.printf(" Error: unknown setting '%s' (try 'help')\n", config);
}
@@ -2707,6 +2735,11 @@ void MyMesh::checkCLIRescueCmd() {
Serial.println(" erase Format filesystem");
Serial.println(" reboot Restart device");
Serial.println(" ls / cat / rm File operations");
#if defined(LilyGo_T5S3_EPaper_Pro)
Serial.println("");
Serial.println(" Display:");
Serial.println(" set backlight on/off/0-255 Control front-light");
#endif
// =====================================================================
// Existing system commands (unchanged)
+1 -1
View File
@@ -8,7 +8,7 @@
#define FIRMWARE_VER_CODE 10
#ifndef FIRMWARE_BUILD_DATE
#define FIRMWARE_BUILD_DATE "8 March 2026"
#define FIRMWARE_BUILD_DATE "11 March 2026"
#endif
#ifndef FIRMWARE_VERSION
+13 -12
View File
@@ -49,10 +49,6 @@
static bool webReaderNeedsRefresh = false;
static bool webReaderTextEntry = false; // True when URL/password entry active
#endif
// AGC reset - periodically re-assert RX boosted gain to prevent sensitivity drift
#define AGC_RESET_INTERVAL_MS 500
static unsigned long lastAGCReset = 0;
// Emoji picker state
#include "EmojiPicker.h"
static bool emojiPickerMode = false;
@@ -90,8 +86,6 @@
TouchInput touchInput(&Wire);
#endif
CPUPowerManager cpuPower;
void initKeyboard();
void handleKeyboardInput();
void drawComposeScreen();
@@ -343,6 +337,11 @@
}
#endif
// Board-agnostic: CPU frequency scaling and AGC reset
CPUPowerManager cpuPower;
#define AGC_RESET_INTERVAL_MS 500
static unsigned long lastAGCReset = 0;
// Believe it or not, this std C function is busted on some platforms!
static uint32_t _atoi(const char* sp) {
uint32_t n = 0;
@@ -436,7 +435,9 @@ static uint32_t _atoi(const char* sp) {
/* GLOBAL OBJECTS */
#ifdef DISPLAY_CLASS
#include "UITask.h"
#include "MapScreen.h" // After BLE — PNGdec headers conflict with BLE if included earlier
#if HAS_GPS
#include "MapScreen.h" // After BLE — PNGdec headers conflict with BLE if included earlier
#endif
UITask ui_task(&board, &serial_interface);
#endif
@@ -749,8 +750,8 @@ void setup() {
initKeyboard();
#endif
// Initialize touch input (CST328)
#ifdef HAS_TOUCHSCREEN
// Initialize touch input (CST328 on T-Deck Pro)
#if defined(LilyGo_TDeck_Pro) && defined(HAS_TOUCHSCREEN)
if (touchInput.begin(CST328_PIN_INT)) {
MESH_DEBUG_PRINTLN("setup() - Touch input initialized");
} else {
@@ -880,6 +881,7 @@ void loop() {
sensors.loop();
// Map screen: periodically update own GPS position and contact markers
#if HAS_GPS
if (ui_task.isOnMapScreen()) {
static unsigned long lastMapUpdate = 0;
if (millis() - lastMapUpdate > 30000) { // Every 30 seconds
@@ -887,9 +889,7 @@ void loop() {
MapScreen* ms = (MapScreen*)ui_task.getMapScreen();
if (ms) {
// Update own GPS position when GPS is enabled
#if HAS_GPS
ms->updateGPSPosition(sensors.node_lat, sensors.node_lon);
#endif
// Always refresh contact markers (new contacts arrive via radio)
ms->clearMarkers();
@@ -905,12 +905,13 @@ void loop() {
}
}
}
#endif
// CPU frequency auto-timeout back to idle
cpuPower.loop();
// Audiobook: service audio decode regardless of which screen is active
#ifndef HAS_4G_MODEM
#if defined(LilyGo_TDeck_Pro) && !defined(HAS_4G_MODEM)
{
AudiobookPlayerScreen* abPlayer =
(AudiobookPlayerScreen*)ui_task.getAudiobookScreen();
+37 -1
View File
@@ -4,7 +4,9 @@
#include "NotesScreen.h"
#include "RepeaterAdminScreen.h"
#include "DiscoveryScreen.h"
#include "MapScreen.h"
#if HAS_GPS
#include "MapScreen.h"
#endif
#include "target.h"
#if defined(WIFI_SSID) || defined(MECK_WIFI_COMPANION)
#include <WiFi.h>
@@ -340,7 +342,11 @@ public:
y += 10;
display.drawTextCentered(display.width() / 2, y, "[N] Notes [S] Settings ");
y += 10;
#if HAS_GPS
display.drawTextCentered(display.width() / 2, y, "[E] Reader [G] Maps ");
#else
display.drawTextCentered(display.width() / 2, y, "[E] Reader ");
#endif
y += 10;
#if defined(HAS_4G_MODEM) && defined(MECK_WEB_READER)
display.drawTextCentered(display.width() / 2, y, "[T] Phone [B] Browser ");
@@ -359,7 +365,11 @@ public:
// Nav hint
display.setColor(DisplayDriver::GREEN);
#if defined(LilyGo_T5S3_EPaper_Pro)
display.drawTextCentered(display.width() / 2, y, "Tap screen to cycle home views");
#else
display.drawTextCentered(display.width() / 2, y, "Press A/D to cycle home views");
#endif
display.setTextSize(1); // restore
} else if (_page == HomePage::RECENT) {
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE);
@@ -952,7 +962,11 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
#ifdef HAS_4G_MODEM
sms_screen = new SMSScreen(this);
#endif
#if HAS_GPS
map_screen = new MapScreen(this);
#else
map_screen = nullptr;
#endif
setCurrScreen(splash);
}
@@ -1362,6 +1376,16 @@ char UITask::handleLongPress(char c) {
char UITask::handleDoubleClick(char c) {
MESH_DEBUG_PRINTLN("UITask: double click triggered");
#if defined(LilyGo_T5S3_EPaper_Pro)
// Double-click boot button → full brightness backlight toggle
if (board.isBacklightOn()) {
board.setBacklight(false);
} else {
board.setBacklightBrightness(153);
board.setBacklight(true);
}
c = 0; // consume event — don't pass through as navigation
#endif
checkDisplayOn(c);
return c;
}
@@ -1369,7 +1393,17 @@ char UITask::handleDoubleClick(char c) {
char UITask::handleTripleClick(char c) {
MESH_DEBUG_PRINTLN("UITask: triple click triggered");
checkDisplayOn(c);
#if defined(LilyGo_T5S3_EPaper_Pro)
// Triple-click → half brightness backlight (comfortable reading)
if (board.isBacklightOn()) {
board.setBacklight(false); // If already on, turn off
} else {
board.setBacklightBrightness(80);
board.setBacklight(true);
}
#else
toggleBuzzer();
#endif
c = 0;
return c;
}
@@ -1643,6 +1677,7 @@ void UITask::gotoWebReader() {
}
#endif
#if HAS_GPS
void UITask::gotoMapScreen() {
MapScreen* map = (MapScreen*)map_screen;
if (_display != NULL) {
@@ -1655,6 +1690,7 @@ void UITask::gotoMapScreen() {
_auto_off = millis() + AUTO_OFF_MILLIS;
_next_refresh = 100;
}
#endif
void UITask::onAdminLoginResult(bool success, uint8_t permissions, uint32_t server_time) {
if (repeater_admin && isOnRepeaterAdmin()) {
+2
View File
@@ -121,7 +121,9 @@ public:
void gotoAudiobookPlayer(); // Navigate to audiobook player
void gotoRepeaterAdmin(int contactIdx); // Navigate to repeater admin
void gotoDiscoveryScreen(); // Navigate to node discovery scan
#if HAS_GPS
void gotoMapScreen(); // Navigate to map tile screen
#endif
#ifdef MECK_WEB_READER
void gotoWebReader(); // Navigate to web reader (browser)
#endif