Refactored to decouple vp_init from speaking of splash screen.

This commit is contained in:
vk7js 2022-10-25 10:47:51 +11:00 committed by Silvano Seva
parent 16d750c55c
commit d5d49fbbb2
6 changed files with 40 additions and 19 deletions

View File

@ -223,5 +223,9 @@ vpQueueFlags_t vp_getVoiceLevelQueueFlags();
*
*/
void vp_playMenuBeepIfNeeded(bool firstItem);
/**
*
*/
void vp_announceSplashScreen();
#endif // VOICE_PROMPT_UTILS_H

View File

@ -236,8 +236,6 @@ typedef enum
vpModeSpecificInfo = 0x08,
vpPower = 0x10,
vpBankNameOrAllChannels = 0x20,
vpSplashInfo = 0x40,
vpAllInfoExceptSplash = 0x3f,
vpAllInfo = 0xff
}
vpSummaryInfoFlags_t;

View File

@ -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);

View File

@ -33,6 +33,8 @@
#include <beeps.h>
#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(&currentLanguage->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(&currentLanguage->openRTX);
vp_queuePrompt(PROMPT_VFO);
vp_announceFrequencies(state.channel.rx_frequency,
state.channel.tx_frequency,
localFlags);
vp_announceRadioMode(state.channel.mode, localFlags);
vp_play();
}

View File

@ -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()

View File

@ -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
{