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:
pelgraine
2026-06-22 07:01:18 +10:00
parent 6aa12f27b5
commit 8133ab5856
7 changed files with 49 additions and 6 deletions
+9
View File
@@ -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();
}