diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 2065b558..137055e8 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -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; diff --git a/examples/companion_radio/ui-new/Alarmscreen.h b/examples/companion_radio/ui-new/Alarmscreen.h index 18bcb110..59b27872 100644 --- a/examples/companion_radio/ui-new/Alarmscreen.h +++ b/examples/companion_radio/ui-new/Alarmscreen.h @@ -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 }