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

View File

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

View File

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