From d5d49fbbb250c350e4ebc4ce727188c762520ab1 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Tue, 25 Oct 2022 10:47:51 +1100 Subject: [PATCH] Refactored to decouple vp_init from speaking of splash screen. --- openrtx/include/core/voicePromptUtils.h | 4 +++ openrtx/include/core/voicePrompts.h | 2 -- openrtx/src/core/openrtx.c | 1 + openrtx/src/core/voicePromptUtils.c | 35 ++++++++++++++++++++++--- openrtx/src/core/voicePrompts.c | 11 -------- openrtx/src/ui/ui.c | 6 ++--- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index e8114e2a..222cb9fe 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -223,5 +223,9 @@ vpQueueFlags_t vp_getVoiceLevelQueueFlags(); * */ void vp_playMenuBeepIfNeeded(bool firstItem); +/** + * + */ +void vp_announceSplashScreen(); #endif // VOICE_PROMPT_UTILS_H diff --git a/openrtx/include/core/voicePrompts.h b/openrtx/include/core/voicePrompts.h index dd27588f..2b624077 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -236,8 +236,6 @@ typedef enum vpModeSpecificInfo = 0x08, vpPower = 0x10, vpBankNameOrAllChannels = 0x20, - vpSplashInfo = 0x40, - vpAllInfoExceptSplash = 0x3f, vpAllInfo = 0xff } vpSummaryInfoFlags_t; diff --git a/openrtx/src/core/openrtx.c b/openrtx/src/core/openrtx.c index c0ee4adb..9338ef26 100644 --- a/openrtx/src/core/openrtx.c +++ b/openrtx/src/core/openrtx.c @@ -68,6 +68,7 @@ void openrtx_init() // Display splash screen, turn on backlight after a suitable time to // hide random pixels during render process ui_drawSplashScreen(true); + vp_announceSplashScreen(); gfx_render(); sleepFor(0u, 30u); platform_setBacklightLevel(state.settings.brightness); diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index fca3f033..62c75512 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -33,6 +33,8 @@ #include #include "interfaces/cps_io.h" +const uint16_t BOOT_MELODY[] = {400, 3, 600, 3, 800, 3, 0, 0}; + static void clearCurrPromptIfNeeded(const vpQueueFlags_t flags) { if (flags & vpqInit) @@ -210,9 +212,6 @@ void vp_announceChannelSummary(const channel_t* channel, localFlags |= vpqIncludeDescriptions; } - if ((infoFlags & vpSplashInfo) != 0) - vp_queueStringTableEntry(¤tLanguage->openRTX); - // If VFO mode, announce VFO. // channelNumber will be 0 if called from VFO mode. if ((infoFlags & vpChannelNameOrVFO) != 0) @@ -1037,3 +1036,33 @@ void vp_playMenuBeepIfNeeded(bool firstItem) else vp_beep(BEEP_MENU_ITEM, SHORT_BEEP); } + +void vp_announceSplashScreen() +{ + if (state.settings.vpLevel < vpBeep) + return; + + vp_flush(); + + if (state.settings.vpLevel == vpBeep) + { + vp_beepSeries(BOOT_MELODY); + return; + } + + vpQueueFlags_t localFlags = vpqAddSeparatingSilence; + + // Force on the descriptions for level 3. + if (state.settings.vpLevel == vpHigh) + { + localFlags |= vpqIncludeDescriptions; + } + + vp_queueStringTableEntry(¤tLanguage->openRTX); + vp_queuePrompt(PROMPT_VFO); + vp_announceFrequencies(state.channel.rx_frequency, + state.channel.tx_frequency, + localFlags); + vp_announceRadioMode(state.channel.mode, localFlags); + vp_play(); +} diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index 6d4afb3b..74bfcae0 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -34,7 +34,6 @@ static const uint32_t VOICE_PROMPTS_DATA_MAGIC = 0x5056; //'VP' static const uint32_t VOICE_PROMPTS_DATA_VERSION = 0x1000; // v1000 OpenRTX -const uint16_t BOOT_MELODY[] = {400, 3, 600, 3, 800, 3, 0, 0}; #define VOICE_PROMPTS_TOC_SIZE 350 #define CODEC2_HEADER_SIZE 7 @@ -387,16 +386,6 @@ void vp_init() // Initialize codec2 module codec_init(); - if (state.settings.vpLevel == vpBeep) - { - vp_beepSeries(BOOT_MELODY); - } - else if (state.settings.vpLevel > vpBeep) - {// announce the splash msg and VFO. - vpSummaryInfoFlags_t infoFlags = vpChannelNameOrVFO | vpFrequencies | - vpRadioMode | vpSplashInfo; - vp_announceChannelSummary(&state.channel, 0, 0, infoFlags); - } } void vp_terminate() diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 1ea73ef7..00233bdc 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1379,7 +1379,7 @@ void ui_updateFSM(bool *sync_rtx) {// quick press repeat vp, long press summary. if (msg.long_press) vp_announceChannelSummary(&state.channel, 0, - state.bank, vpAllInfoExceptSplash); + state.bank, vpAllInfo); else vp_replayLastPrompt(); f1Handled = true; @@ -1474,7 +1474,7 @@ void ui_updateFSM(bool *sync_rtx) &state.channel, state.channel_index, state.bank, - vpAllInfoExceptSplash); + vpAllInfo); } else { @@ -1525,7 +1525,7 @@ void ui_updateFSM(bool *sync_rtx) { vp_announceChannelSummary(&state.channel, state.channel_index+1, - state.bank, vpAllInfoExceptSplash); + state.bank, vpAllInfo); } else {