From 44353fcf9ea49447f5ff7faa1a80d94c1b4b4d2b Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Sun, 3 May 2026 23:15:32 +1000 Subject: [PATCH] hibernation page navigation bugfix --- examples/companion_radio/main.cpp | 6 +++++- examples/companion_radio/ui-new/UITask.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index acf694db..14c44b46 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -1495,7 +1495,11 @@ static void lastHeardToggleContact() { if (horizontal) { return (dx < 0) ? (char)KEY_NEXT : (char)KEY_PREV; } - return (char)KEY_NEXT; // vertical swipe = next (default) + // Shutdown page: vertical swipe toggles hibernate/power off + if (ui_task.isHomeOnShutdownPage()) { + return 'w'; // toggle (direction doesn't matter) + } + return (char)KEY_NEXT; // vertical swipe = next page (default) } // Settings: horizontal swipe → a/d for picker/number editing diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 6d3e46c5..3490fe34 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -1115,7 +1115,9 @@ public: return true; // eat all other keys while confirming } // Up/down toggles between hibernate and power off - if (c == KEY_NEXT || c == 's' || c == KEY_PREV || c == 'w') { + // Only 'w'/'s' (keyboard) — KEY_NEXT/KEY_PREV fall through to page cycling + // so touch swipes and taps can still navigate away from this page. + if (c == 'w' || c == 's') { _poweroff_selected = !_poweroff_selected; return true; } @@ -1131,11 +1133,11 @@ public: // Left/right fall through to page cycling below } - if (c == KEY_LEFT || c == KEY_PREV) { + if (c == KEY_LEFT || c == KEY_PREV || c == 'a') { _page = (_page + HomePage::Count - 1) % HomePage::Count; return true; } - if (c == KEY_NEXT || c == KEY_RIGHT) { + if (c == KEY_NEXT || c == KEY_RIGHT || c == 'd') { _page = (_page + 1) % HomePage::Count; if (_page == HomePage::RECENT) { _task->showAlert("Recent adverts", 800);