diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 2cca883..665c6fb 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) { @@ -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 8ff8b70..88c1779 100644 --- a/examples/companion_radio/ui-new/UITask.h +++ b/examples/companion_radio/ui-new/UITask.h @@ -56,7 +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 + UIScreen* audiobook_screen; // Audiobook player screen (null if not available) UIScreen* curr; void userLedHandler(); @@ -97,10 +97,6 @@ public: bool isOnNotesScreen() const { return curr == notes_screen; } bool isOnSettingsScreen() const { return curr == settings_screen; } bool isOnAudiobookPlayer() const { return curr == audiobook_screen; } - - // Check if audio is playing/paused in the background (for status indicators) - bool isAudioPlayingInBackground() const; - bool isAudioPausedInBackground() const; uint8_t getChannelScreenViewIdx() const; void toggleBuzzer(); @@ -125,7 +121,7 @@ public: UIScreen* getChannelScreen() const { return channel_screen; } UIScreen* getSettingsScreen() const { return settings_screen; } UIScreen* getAudiobookScreen() const { return audiobook_screen; } - void setAudiobookScreen(UIScreen* screen) { audiobook_screen = screen; } + void setAudiobookScreen(UIScreen* s) { audiobook_screen = s; } // from AbstractUITask void msgRead(int msgcount) override;