Add GPS voiceprompts announcing

Removed flag parameters from summary and GPSInfo,
hooked up the GPS info so that if the GPS screen is active,
long hold f1 will read the GPS summary and f1 will repeat the last
voice prompt like on the VFO and channel screens.
This commit is contained in:
vk7js 2022-05-19 20:29:24 +10:00 committed by Silvano Seva
parent c0371dad2a
commit 8527b8a6ef
3 changed files with 40 additions and 31 deletions

View File

@ -43,8 +43,7 @@ void vpQueueFrequency(freq_t freq);
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags);
void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags);
void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags);
void announceChannelSummary(channel_t* channel, uint16_t channelIndex,
VoicePromptQueueFlags_T flags);
void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t bank);
void AnnounceInputChar(char ch);
void announceInputReceiveOrTransmit(bool tx, VoicePromptQueueFlags_T flags);
void ReplayLastPrompt();
@ -67,7 +66,7 @@ void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode, VoicePromptQue
void announceBank(uint16_t bank, VoicePromptQueueFlags_T flags);
void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags);
#ifdef GPS_PRESENT
void announceGPSInfo(VoicePromptQueueFlags_T flags);
void announceGPSInfo();
#endif // GPS_PRESENT
VoicePromptQueueFlags_T GetQueueFlagsForVoiceLevel();

View File

@ -179,15 +179,14 @@ void anouncePower(float power, VoicePromptQueueFlags_T flags)
vpPlayIfNeeded(flags);
}
void announceChannelSummary(channel_t* channel, uint16_t channelIndex,
VoicePromptQueueFlags_T flags)
void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t bank)
{
if (!channel) return;
vpInitIfNeeded(flags);
vpInit();
// mask off init and play because this function will handle init and play.
VoicePromptQueueFlags_T localFlags=flags & ~(vpqInit | vpqPlayImmediately);
VoicePromptQueueFlags_T localFlags= vpqAddSeparatingSilence;
// Force on the descriptions for level 3.
if (state.settings.vpLevel == vpHigh)
localFlags |= vpqIncludeDescriptions;
@ -235,7 +234,7 @@ VoicePromptQueueFlags_T flags)
if (channelIndex > 0) // i.e. not called from VFO.
announceBank(bank, localFlags);
vpPlayIfNeeded(flags);
vpPlay();
}
void AnnounceInputChar(char ch)
@ -466,13 +465,14 @@ void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags)
}
#ifdef GPS_PRESENT
void announceGPSInfo(VoicePromptQueueFlags_T flags)
void announceGPSInfo()
{
if (!state.settings.gps_enabled)
return;
vpInitIfNeeded(flags);
if (flags & vpqIncludeDescriptions)
vpInit();
VoicePromptQueueFlags_T flags = vpqIncludeDescriptions | vpqAddSeparatingSilence;
vpQueueStringTableEntry(&currentLanguage->gps);
switch (state.gps_data.fix_quality)
@ -494,9 +494,12 @@ void announceGPSInfo(VoicePromptQueueFlags_T flags)
break;
default:
vpQueueStringTableEntry(&currentLanguage->error);
vpPlayIfNeeded(flags);
vpPlay();
return;
}
addSilenceIfNeeded(flags);
switch(state.gps_data.fix_type)
{
@ -540,7 +543,7 @@ void announceGPSInfo(VoicePromptQueueFlags_T flags)
vpQueuePrompt(PROMPT_SATELLITES);
vpQueueInteger(__builtin_popcount(state.gps_data.active_sats));
vpPlayIfNeeded(flags);
vpPlay();
}
#endif // GPS_PRESENT

View File

@ -1167,14 +1167,14 @@ void ui_updateFSM(bool *sync_rtx)
}
else if(msg.keys & KEY_F1)
{
if (state.settings.vpLevel > vpBeep)
{// quick press repeat vp, long press summary.
if (msg.long_press)
announceChannelSummary(&state.channel, 0, (vpqInit | vpqPlayImmediately));
else
ReplayLastPrompt();
f1Handled = true;
}
if (state.settings.vpLevel > vpBeep)
{// quick press repeat vp, long press summary.
if (msg.long_press)
announceChannelSummary(&state.channel, 0, state.bank);
else
ReplayLastPrompt();
f1Handled = true;
}
}
else if(input_isNumberPressed(msg))
{
@ -1253,15 +1253,14 @@ void ui_updateFSM(bool *sync_rtx)
ui_state.edit_mode = false;
else if(msg.keys & KEY_F1)
{
if (state.settings.vpLevel > vpBeep)
{// quick press repeat vp, long press summary.
if (msg.long_press)
announceChannelSummary(&state.channel, state.channel_index,
(vpqInit|vpqPlayImmediately));
else
ReplayLastPrompt();
f1Handled=true;
}
if (state.settings.vpLevel > vpBeep)
{// quick press repeat vp, long press summary.
if (msg.long_press)
announceChannelSummary(&state.channel, state.channel_index, state.bank);
else
ReplayLastPrompt();
f1Handled=true;
}
}
else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN ||
msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT)
@ -1436,7 +1435,15 @@ void ui_updateFSM(bool *sync_rtx)
#ifdef GPS_PRESENT
// GPS menu screen
case MENU_GPS:
if(msg.keys & KEY_ESC)
if ((msg.keys & KEY_F1) && (state.settings.vpLevel > vpBeep))
{// quick press repeat vp, long press summary.
if (msg.long_press)
announceGPSInfo();
else
ReplayLastPrompt();
f1Handled = true;
}
else if(msg.keys & KEY_ESC)
_ui_menuBack(MENU_TOP);
break;
#endif