mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-07 17:22:44 +02:00
Max: update build date and firmware version. Add keyboard LED brightness setting (MAX); fix standalone unread counter
Keyboard LED brightness (T-Deck Pro MAX): Adds a "Keyboard LED" row to Settings (MAX only), below Backlight Brightness and mirroring it: 5-100% in 5% steps, default 50%. The both-shifts keyboard backlight toggle previously used a hardcoded PWM level of 8 (~3%), too dim for some users; it now reads the stored percentage and maps it to PWM, taking effect on the next toggle. - NodePrefs.h: new kb_backlight_pct field (5..100, default 50) - Settingsscreen.h: ROW_KB_BACKLIGHT row plus label/edit handling - DataStore.cpp: load/save/clamp, appended so existing prefs files stay compatible (fall back to 50%) - main.cpp: toggle uses kb_backlight_pct (percent -> PWM) instead of 8 Standalone unread counter fix: On standalone builds the home-page MSG count and channel-picker unread badges never updated, although messages arrived and displayed normally. ArduinoSerialInterface::isConnected() is hardcoded to return true (a plain UART has no connection state), so the periodic setHasConnection(_serial->isConnected()) in MyMesh left hasConnection() permanently true -- making UITask mark every received message read on arrival. The same stuck flag also suppressed the DM counter and the new-message screen wake. Guard the call so only builds with a real companion (BLE / WiFi / wired SERIAL_RX) derive connection state from the interface; companion-less builds report not-connected. The core ArduinoSerialInterface is unchanged, preserving wired-companion behaviour. - MyMesh.cpp: guard setHasConnection() for companion-less builds
This commit is contained in:
@@ -202,6 +202,10 @@ void DataStore::loadPrefs(NodePrefs& prefs, double& node_lat, double& node_lon)
|
||||
if (prefs.backlight_brightness_pct < 5 || prefs.backlight_brightness_pct > 100) {
|
||||
prefs.backlight_brightness_pct = 100;
|
||||
}
|
||||
// Same treatment for the keyboard LED level (fresh device = memset 0).
|
||||
if (prefs.kb_backlight_pct < 5 || prefs.kb_backlight_pct > 100) {
|
||||
prefs.kb_backlight_pct = 50;
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& node_lat, double& node_lon) {
|
||||
@@ -303,6 +307,9 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
||||
if (file.read((uint8_t *)&_prefs.backlight_brightness_pct, sizeof(_prefs.backlight_brightness_pct)) != sizeof(_prefs.backlight_brightness_pct)) {
|
||||
_prefs.backlight_brightness_pct = 100; // default: full brightness
|
||||
}
|
||||
if (file.read((uint8_t *)&_prefs.kb_backlight_pct, sizeof(_prefs.kb_backlight_pct)) != sizeof(_prefs.kb_backlight_pct)) {
|
||||
_prefs.kb_backlight_pct = 50; // default: 50%
|
||||
}
|
||||
|
||||
// Clamp to valid ranges
|
||||
if (_prefs.dark_mode > 1) _prefs.dark_mode = 0;
|
||||
@@ -318,6 +325,7 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
||||
}
|
||||
if (_prefs.lora_antenna > 1) _prefs.lora_antenna = 0;
|
||||
if (_prefs.backlight_brightness_pct < 5 || _prefs.backlight_brightness_pct > 100) _prefs.backlight_brightness_pct = 100;
|
||||
if (_prefs.kb_backlight_pct < 5 || _prefs.kb_backlight_pct > 100) _prefs.kb_backlight_pct = 50;
|
||||
// auto_lock_minutes: only accept known options (0, 2, 5, 10, 15, 30)
|
||||
{
|
||||
uint8_t alm = _prefs.auto_lock_minutes;
|
||||
@@ -380,6 +388,7 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_
|
||||
file.write((uint8_t *)_prefs.channel_notif, sizeof(_prefs.channel_notif)); // 153
|
||||
file.write((uint8_t *)&_prefs.lora_antenna, sizeof(_prefs.lora_antenna)); // 174
|
||||
file.write((uint8_t *)&_prefs.backlight_brightness_pct, sizeof(_prefs.backlight_brightness_pct)); // 175
|
||||
file.write((uint8_t *)&_prefs.kb_backlight_pct, sizeof(_prefs.kb_backlight_pct)); // 176
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -3724,7 +3724,15 @@ void MyMesh::loop() {
|
||||
}
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#if defined(BLE_PIN_CODE) || defined(MECK_WIFI_COMPANION) || defined(WIFI_SSID) || defined(SERIAL_RX)
|
||||
if (_ui) _ui->setHasConnection(_serial->isConnected());
|
||||
#else
|
||||
// Standalone build: no companion app. ArduinoSerialInterface::isConnected()
|
||||
// is hardcoded to return true, which would make hasConnection() permanently
|
||||
// true here -- marking every received message read on arrival and preventing
|
||||
// the unread counter (and DM counter / new-message screen wake) from updating.
|
||||
if (_ui) _ui->setHasConnection(false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#define FIRMWARE_VER_CODE 11
|
||||
|
||||
#ifndef FIRMWARE_BUILD_DATE
|
||||
#define FIRMWARE_BUILD_DATE "17 June 2026"
|
||||
#define FIRMWARE_BUILD_DATE "22 June 2026"
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "Meck v1.12.2"
|
||||
#define FIRMWARE_VERSION "Meck v1.12.3"
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
|
||||
@@ -74,6 +74,11 @@ struct NodePrefs { // persisted to file
|
||||
// 0 = unset/legacy; treated as the default 100 on load.
|
||||
uint8_t backlight_brightness_pct; // 5..100, default 100
|
||||
|
||||
// --- Keyboard LED brightness, T-Deck Pro MAX only ---
|
||||
// Percentage (5..100) the both-shifts toggle turns the keyboard backlight on to.
|
||||
// Takes effect on next toggle. Default 50.
|
||||
uint8_t kb_backlight_pct; // 5..100, default 50
|
||||
|
||||
// --- Font helpers (inline, no overhead) ---
|
||||
// Returns the DisplayDriver text-size index for "small/body" text.
|
||||
// T-Deck Pro: 0 = built-in 6×8 (or 7pt with custom fonts), 1 = 9pt.
|
||||
|
||||
@@ -4306,7 +4306,8 @@ void handleKeyboardInput() {
|
||||
if (key == KB_KEY_KBD_BACKLIGHT) {
|
||||
static bool kbdBacklightOn = false;
|
||||
kbdBacklightOn = !kbdBacklightOn;
|
||||
analogWrite(KB_BL_PIN, kbdBacklightOn ? 8 : 0);
|
||||
uint8_t kbPct = the_mesh.getNodePrefs()->kb_backlight_pct;
|
||||
analogWrite(KB_BL_PIN, kbdBacklightOn ? (uint8_t)((kbPct * 255 + 50) / 100) : 0);
|
||||
Serial.printf("Keyboard backlight %s\n", kbdBacklightOn ? "ON" : "OFF");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ enum SettingsRowType : uint8_t {
|
||||
ROW_TX_POWER, // TX power (1-20 dBm)
|
||||
ROW_UTC_OFFSET, // UTC offset (-12 to +14)
|
||||
ROW_BACKLIGHT_BRIGHTNESS, // Backlight brightness % the heart button toggles to (MAX only)
|
||||
ROW_KB_BACKLIGHT, // Keyboard LED brightness % (MAX only)
|
||||
ROW_MSG_NOTIFY, // Keyboard flash on new msg toggle
|
||||
ROW_DARK_MODE, // Dark mode toggle (inverted display)
|
||||
ROW_LARGE_FONT, // Font size toggle: 0=tiny (default), 1=larger
|
||||
@@ -496,6 +497,7 @@ private:
|
||||
addRow(ROW_UTC_OFFSET);
|
||||
#if defined(LilyGo_TDeck_Pro_Max)
|
||||
addRow(ROW_BACKLIGHT_BRIGHTNESS);
|
||||
addRow(ROW_KB_BACKLIGHT);
|
||||
#endif
|
||||
addRow(ROW_MSG_NOTIFY);
|
||||
#if HAS_GPS
|
||||
@@ -1918,6 +1920,15 @@ public:
|
||||
display.print(tmp);
|
||||
break;
|
||||
|
||||
case ROW_KB_BACKLIGHT:
|
||||
if (editing && _editMode == EDIT_NUMBER) {
|
||||
snprintf(tmp, sizeof(tmp), "Keyboard LED: %d%% " EDIT_ADJ_HINT, _editInt);
|
||||
} else {
|
||||
snprintf(tmp, sizeof(tmp), "Keyboard LED: %d%%", _prefs->kb_backlight_pct);
|
||||
}
|
||||
display.print(tmp);
|
||||
break;
|
||||
|
||||
case ROW_MSG_NOTIFY:
|
||||
snprintf(tmp, sizeof(tmp), "Msg LED Flash: %s",
|
||||
_prefs->kb_flash_notify ? "ON" : "OFF");
|
||||
@@ -3459,6 +3470,7 @@ public:
|
||||
case ROW_TX_POWER: if (_editInt < MAX_LORA_TX_POWER) _editInt++; break;
|
||||
case ROW_UTC_OFFSET: if (_editInt < 14) _editInt++; break;
|
||||
case ROW_BACKLIGHT_BRIGHTNESS: if (_editInt < 100) { _editInt += 5; if (_editInt > 100) _editInt = 100; } break;
|
||||
case ROW_KB_BACKLIGHT: if (_editInt < 100) { _editInt += 5; if (_editInt > 100) _editInt = 100; } break;
|
||||
case ROW_PATH_HASH_SIZE: if (_editInt < 3) _editInt++; break;
|
||||
default: break;
|
||||
}
|
||||
@@ -3477,6 +3489,7 @@ public:
|
||||
case ROW_TX_POWER: if (_editInt > 1) _editInt--; break;
|
||||
case ROW_UTC_OFFSET: if (_editInt > -12) _editInt--; break;
|
||||
case ROW_BACKLIGHT_BRIGHTNESS: if (_editInt > 5) { _editInt -= 5; if (_editInt < 5) _editInt = 5; } break;
|
||||
case ROW_KB_BACKLIGHT: if (_editInt > 5) { _editInt -= 5; if (_editInt < 5) _editInt = 5; } break;
|
||||
case ROW_PATH_HASH_SIZE: if (_editInt > 1) _editInt--; break;
|
||||
default: break;
|
||||
}
|
||||
@@ -3509,6 +3522,10 @@ public:
|
||||
_prefs->backlight_brightness_pct = (uint8_t)constrain(_editInt, 5, 100);
|
||||
the_mesh.savePrefs();
|
||||
break;
|
||||
case ROW_KB_BACKLIGHT:
|
||||
_prefs->kb_backlight_pct = (uint8_t)constrain(_editInt, 5, 100);
|
||||
the_mesh.savePrefs();
|
||||
break;
|
||||
case ROW_PATH_HASH_SIZE:
|
||||
_prefs->path_hash_mode = (uint8_t)constrain(_editInt - 1, 0, 2); // display 1-3, store 0-2
|
||||
the_mesh.savePrefs();
|
||||
@@ -3598,6 +3615,9 @@ public:
|
||||
case ROW_BACKLIGHT_BRIGHTNESS:
|
||||
startEditInt(_prefs->backlight_brightness_pct);
|
||||
break;
|
||||
case ROW_KB_BACKLIGHT:
|
||||
startEditInt(_prefs->kb_backlight_pct);
|
||||
break;
|
||||
case ROW_MSG_NOTIFY:
|
||||
_prefs->kb_flash_notify = _prefs->kb_flash_notify ? 0 : 1;
|
||||
the_mesh.savePrefs();
|
||||
|
||||
@@ -177,7 +177,7 @@ build_flags =
|
||||
-D MECK_WEB_READER=1
|
||||
-D HAS_4G_MODEM=1
|
||||
-D MECK_OTA_UPDATE=1
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.2.MAX"'
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.3.MAX"'
|
||||
build_src_filter = ${LilyGo_TDeck_Pro_Max.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
@@ -207,7 +207,7 @@ build_flags =
|
||||
-D MECK_WEB_READER=1
|
||||
-D MECK_OTA_UPDATE=1
|
||||
-D HAS_4G_MODEM=1
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.2.MAX.WiFi"'
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.3.MAX.WiFi"'
|
||||
build_src_filter = ${LilyGo_TDeck_Pro_Max.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
@@ -233,7 +233,7 @@ build_flags =
|
||||
-D MECK_OTA_UPDATE=1
|
||||
-D HAS_4G_MODEM=1
|
||||
-D MECK_WEB_READER=1
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.2.MAX.SA"'
|
||||
-D FIRMWARE_VERSION='"Meck v1.12.3.MAX.SA"'
|
||||
build_src_filter = ${LilyGo_TDeck_Pro_Max.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
|
||||
Reference in New Issue
Block a user