Fix alarm screen hint text when autolock has been applied

This commit is contained in:
pelgraine
2026-06-07 22:17:57 +10:00
parent 51ef01f3a6
commit 7f9503c988
2 changed files with 18 additions and 4 deletions
+5
View File
@@ -1085,6 +1085,11 @@ static uint32_t _atoi(const char* sp) {
#include "MapScreen.h" // After BLE -- PNGdec headers conflict with BLE if included earlier
#endif
UITask ui_task(&board, &serial_interface);
#ifdef MECK_AUDIO_VARIANT
// Lets the alarm ringing screen (which only forward-declares UITask) query
// the lock state without pulling in the full UITask header.
bool meck_alarm_is_locked() { return ui_task.isLocked(); }
#endif
#endif
StdRNG fast_rng;
+13 -4
View File
@@ -53,6 +53,10 @@ void meck_alarm_haptic_buzz();
void meck_alarm_haptic_stop();
#endif
// Lock-state query, defined in main.cpp. This UI header only forward-declares
// UITask, so it cannot call _task->isLocked() directly; the shim bridges it.
bool meck_alarm_is_locked();
// ============================================================================
// Configuration
// ============================================================================
@@ -753,11 +757,16 @@ private:
// Dismiss instruction — large and obvious
display.setColor(DisplayDriver::GREEN);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 64, "ANY KEY: Dismiss");
if (meck_alarm_is_locked()) {
// Keys are ignored while locked; the user unlocks with the button first.
display.drawTextCentered(display.width() / 2, 64, "Unlock to dismiss");
} else {
display.drawTextCentered(display.width() / 2, 64, "ANY KEY: Dismiss");
display.setTextSize(0);
display.setColor(DisplayDriver::LIGHT);
display.drawTextCentered(display.width() / 2, 80, "Z: Snooze 5 min");
display.setTextSize(0);
display.setColor(DisplayDriver::LIGHT);
display.drawTextCentered(display.width() / 2, 80, "Z: Snooze 5 min");
}
// No footer in ringing mode — keep it clean and urgent
}