From 8cdf19a8480d04f677f73ca03a82c4129f9f4ccb Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Sat, 14 Feb 2026 16:31:32 +1100 Subject: [PATCH] applied same fixes as audio player branch with minor display edit --- examples/companion_radio/ui-new/UITask.cpp | 19 +++++++++++++++---- examples/companion_radio/ui-new/UITask.h | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 2cca8831..8098df1d 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -40,7 +40,7 @@ class SplashScreen : public UIScreen { UITask* _task; unsigned long dismiss_after; - char _version_info[12]; + char _version_info[24]; public: SplashScreen(UITask* task) : _task(task) { @@ -285,11 +285,11 @@ public: display.setTextSize(0); // tinyfont 6x8 monospaced display.drawTextCentered(display.width() / 2, y, "Press:"); y += 12; - display.drawTextCentered(display.width() / 2, y, "[M] Messages [C] Contacts"); + display.drawTextCentered(display.width() / 2, y, "[M] Messages [C] Contacts"); y += 10; - display.drawTextCentered(display.width() / 2, y, "[N] Notes [S] Settings"); + display.drawTextCentered(display.width() / 2, y, "[N] Notes [S] Settings"); y += 10; - display.drawTextCentered(display.width() / 2, y, "[E] Reader [P] Audiobooks"); + display.drawTextCentered(display.width() / 2, y, "[E] Reader "); y += 14; // Nav hint @@ -772,6 +772,7 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no text_reader = new TextReaderScreen(this); notes_screen = new NotesScreen(this); settings_screen = new SettingsScreen(this, &rtc_clock, node_prefs); + audiobook_screen = nullptr; // Created and assigned from main.cpp if audio hardware present setCurrScreen(splash); } @@ -1241,6 +1242,16 @@ void UITask::gotoOnboarding() { _next_refresh = 100; } +void UITask::gotoAudiobookPlayer() { + if (audiobook_screen == nullptr) return; // No audio hardware + setCurrScreen(audiobook_screen); + if (_display != NULL && !_display->isOn()) { + _display->turnOn(); + } + _auto_off = millis() + AUTO_OFF_MILLIS; + _next_refresh = 100; +} + uint8_t UITask::getChannelScreenViewIdx() const { return ((ChannelScreen *) channel_screen)->getViewChannelIdx(); } diff --git a/examples/companion_radio/ui-new/UITask.h b/examples/companion_radio/ui-new/UITask.h index 1b50f051..88c17796 100644 --- a/examples/companion_radio/ui-new/UITask.h +++ b/examples/companion_radio/ui-new/UITask.h @@ -56,6 +56,7 @@ class UITask : public AbstractUITask { UIScreen* text_reader; // *** NEW: Text reader screen *** UIScreen* notes_screen; // Notes editor screen UIScreen* settings_screen; // Settings/onboarding screen + UIScreen* audiobook_screen; // Audiobook player screen (null if not available) UIScreen* curr; void userLedHandler(); @@ -84,6 +85,7 @@ public: void gotoNotesScreen(); // Navigate to notes editor void gotoSettingsScreen(); // Navigate to settings void gotoOnboarding(); // Navigate to settings in onboarding mode + void gotoAudiobookPlayer(); // Navigate to audiobook player void showAlert(const char* text, int duration_millis) override; void forceRefresh() override { _next_refresh = 100; } int getMsgCount() const { return _msgcount; } @@ -94,6 +96,7 @@ public: bool isOnTextReader() const { return curr == text_reader; } // *** NEW *** bool isOnNotesScreen() const { return curr == notes_screen; } bool isOnSettingsScreen() const { return curr == settings_screen; } + bool isOnAudiobookPlayer() const { return curr == audiobook_screen; } uint8_t getChannelScreenViewIdx() const; void toggleBuzzer(); @@ -117,6 +120,8 @@ public: UIScreen* getContactsScreen() const { return contacts_screen; } UIScreen* getChannelScreen() const { return channel_screen; } UIScreen* getSettingsScreen() const { return settings_screen; } + UIScreen* getAudiobookScreen() const { return audiobook_screen; } + void setAudiobookScreen(UIScreen* s) { audiobook_screen = s; } // from AbstractUITask void msgRead(int msgcount) override;