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
+8
View File
@@ -33,6 +33,11 @@ class UITask : public AbstractUITask {
#endif
unsigned long _next_refresh, _auto_off;
NodePrefs* _node_prefs;
bool _locked;
unsigned long _lock_wake_until; // when to blank screen again after locked wake (5s)
int _lock_seq; // 0=idle, 1=active (long-Back pressed, awaiting Enters)
int _lock_seq_count; // Enter presses so far in current sequence
unsigned long _lock_seq_ms; // millis() when sequence started
char _alert[80];
char _notif_mel_buf[220]; // persistent RTTTL buffer for custom notification melodies
unsigned long _alert_expiry;
@@ -86,6 +91,9 @@ public:
ui_started_at = 0;
_batt_mv = 0;
_msgcount = _room_unread = 0;
_locked = false;
_lock_wake_until = 0;
_lock_seq = 0; _lock_seq_count = 0; _lock_seq_ms = 0;
_last_notif_ch_idx = -1;
_last_notif_dm_valid = false;
memset(_last_notif_dm_prefix, 0, sizeof(_last_notif_dm_prefix));