feat: screen lock — hold Back + 3×Enter to lock/unlock

- Long press Back starts lock sequence; 3 Enter presses within 3s toggle lock
- Locked screen wakes for 5 seconds on any key, showing clock and unlock hint
- Incoming messages do not wake the display while locked
- Auto Lock setting in Display section: locks automatically when screen turns off
- Lock state persisted in UITask; NodePrefs gains auto_lock flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-17 09:55:51 +02:00
co-authored by Claude Sonnet 4.6
parent b068318bc5
commit 9ff42a9296
4 changed files with 126 additions and 8 deletions
@@ -10,6 +10,7 @@ class SettingsScreen : public UIScreen {
SECTION_DISPLAY,
BRIGHTNESS,
AUTO_OFF,
AUTO_LOCK,
BATT_DISPLAY,
CLOCK_SECONDS,
// Sound section
@@ -279,6 +280,10 @@ class SettingsScreen : public UIScreen {
display.print("AutoOff");
display.setCursor(VAL_X, y);
display.print(AUTO_OFF_LABELS[autoOffIndex()]);
} else if (item == AUTO_LOCK) {
display.print("AutoLock");
display.setCursor(VAL_X, y);
display.print((p && p->auto_lock) ? "ON" : "OFF");
#if ENV_INCLUDE_GPS == 1
} else if (item == GPS_INTERVAL) {
display.print("GPS upd");
@@ -452,6 +457,11 @@ public:
if (left) idx = (idx + AUTO_OFF_COUNT - 1) % AUTO_OFF_COUNT;
if (left || right) { p->auto_off_secs = AUTO_OFF_OPTS[idx]; _dirty = true; return true; }
}
if (_selected == AUTO_LOCK && p && (left || right || enter)) {
p->auto_lock ^= 1;
_dirty = true;
return true;
}
#if ENV_INCLUDE_GPS == 1
if (_selected == GPS_INTERVAL && p) {
int idx = gpsIntervalIndex();