mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 18:56:15 +00:00
fix: polish lock screen sequence — hints update instantly, screen stays on, triple-Back blocked
- Turn display on at first Back+Enter press so hints are visible even when screen was dark - Extend _lock_wake_until on every sequence step to prevent screen blanking mid-press - Set _next_refresh=0 on every Enter press (not just on completion) for immediate hint redraw - Add _lock_seq_used flag to suppress the Back CLICK that fires on release after unlock - Block triple-Back (buzzer toggle) when screen is locked Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
43f3621fdc
commit
20e88443b4
@@ -1187,19 +1187,25 @@ void UITask::loop() {
|
|||||||
if (ev == BUTTON_EVENT_CLICK) {
|
if (ev == BUTTON_EVENT_CLICK) {
|
||||||
if (back_btn.isPressed()) {
|
if (back_btn.isPressed()) {
|
||||||
// Enter clicked while Back is held — lock/unlock sequence
|
// Enter clicked while Back is held — lock/unlock sequence
|
||||||
|
if (_display && !_display->isOn()) {
|
||||||
|
_display->turnOn(); // turn on display so hints are visible
|
||||||
|
}
|
||||||
|
_lock_wake_until = millis() + 5000; // keep display on during sequence
|
||||||
if (millis() - _lock_seq_ms > 3000) _lock_seq_count = 0; // timeout reset
|
if (millis() - _lock_seq_ms > 3000) _lock_seq_count = 0; // timeout reset
|
||||||
_lock_seq_count++;
|
_lock_seq_count++;
|
||||||
_lock_seq_ms = millis();
|
_lock_seq_ms = millis();
|
||||||
|
_next_refresh = 0; // update hint immediately on each press
|
||||||
if (_lock_seq_count >= 3) {
|
if (_lock_seq_count >= 3) {
|
||||||
_lock_seq_count = 0;
|
_lock_seq_count = 0;
|
||||||
|
_lock_seq_used = true; // suppress Back release click
|
||||||
_locked = !_locked;
|
_locked = !_locked;
|
||||||
if (_locked) {
|
if (_locked) {
|
||||||
_lock_wake_until = millis() + 2000;
|
_lock_wake_until = millis() + 2000;
|
||||||
} else {
|
} else {
|
||||||
|
if (_display && !_display->isOn()) _display->turnOn();
|
||||||
uint32_t aoff = autoOffMillis();
|
uint32_t aoff = autoOffMillis();
|
||||||
if (aoff > 0) _auto_off = millis() + aoff;
|
if (aoff > 0) _auto_off = millis() + aoff;
|
||||||
}
|
}
|
||||||
_next_refresh = 0;
|
|
||||||
}
|
}
|
||||||
// eat the Enter — don't pass to curr
|
// eat the Enter — don't pass to curr
|
||||||
} else {
|
} else {
|
||||||
@@ -1232,14 +1238,15 @@ void UITask::loop() {
|
|||||||
}
|
}
|
||||||
ev = back_btn.check();
|
ev = back_btn.check();
|
||||||
if (ev == BUTTON_EVENT_CLICK) {
|
if (ev == BUTTON_EVENT_CLICK) {
|
||||||
if (_lock_seq_count > 0) {
|
if (_lock_seq_count > 0 || _lock_seq_used) {
|
||||||
// Back released mid-sequence — cancel sequence, eat the click
|
// Back released mid-sequence or after completing it — cancel/suppress
|
||||||
_lock_seq_count = 0;
|
_lock_seq_count = 0;
|
||||||
|
_lock_seq_used = false;
|
||||||
} else {
|
} else {
|
||||||
c = checkDisplayOn(KEY_CANCEL);
|
c = checkDisplayOn(KEY_CANCEL);
|
||||||
}
|
}
|
||||||
} else if (ev == BUTTON_EVENT_TRIPLE_CLICK) {
|
} else if (ev == BUTTON_EVENT_TRIPLE_CLICK) {
|
||||||
c = handleTripleClick(KEY_SELECT);
|
if (!_locked) c = handleTripleClick(KEY_SELECT);
|
||||||
}
|
}
|
||||||
#elif defined(PIN_USER_BTN)
|
#elif defined(PIN_USER_BTN)
|
||||||
int ev = user_btn.check();
|
int ev = user_btn.check();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class UITask : public AbstractUITask {
|
|||||||
unsigned long _lock_wake_until; // when to blank screen again after locked wake (5s)
|
unsigned long _lock_wake_until; // when to blank screen again after locked wake (5s)
|
||||||
int _lock_seq_count; // Enter presses while Back held (lock/unlock sequence)
|
int _lock_seq_count; // Enter presses while Back held (lock/unlock sequence)
|
||||||
unsigned long _lock_seq_ms; // millis() of last lock-sequence press (for timeout)
|
unsigned long _lock_seq_ms; // millis() of last lock-sequence press (for timeout)
|
||||||
|
bool _lock_seq_used; // true = suppress next back_btn CLICK (post-sequence release)
|
||||||
char _alert[80];
|
char _alert[80];
|
||||||
char _notif_mel_buf[220]; // persistent RTTTL buffer for custom notification melodies
|
char _notif_mel_buf[220]; // persistent RTTTL buffer for custom notification melodies
|
||||||
unsigned long _alert_expiry;
|
unsigned long _alert_expiry;
|
||||||
@@ -92,7 +93,7 @@ public:
|
|||||||
_msgcount = _room_unread = 0;
|
_msgcount = _room_unread = 0;
|
||||||
_locked = false;
|
_locked = false;
|
||||||
_lock_wake_until = 0;
|
_lock_wake_until = 0;
|
||||||
_lock_seq_count = 0; _lock_seq_ms = 0;
|
_lock_seq_count = 0; _lock_seq_ms = 0; _lock_seq_used = false;
|
||||||
_last_notif_ch_idx = -1;
|
_last_notif_ch_idx = -1;
|
||||||
_last_notif_dm_valid = false;
|
_last_notif_dm_valid = false;
|
||||||
memset(_last_notif_dm_prefix, 0, sizeof(_last_notif_dm_prefix));
|
memset(_last_notif_dm_prefix, 0, sizeof(_last_notif_dm_prefix));
|
||||||
|
|||||||
Reference in New Issue
Block a user