diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index a1886208..3c99242f 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -42,6 +42,7 @@ void announceChannelName(channel_t* channel, uint16_t channelIndex, VoicePromptQ 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 AnnounceInputChar(char ch); @@ -56,4 +57,5 @@ character by character. */ void announceText( char* text, VoicePromptQueueFlags_T flags); void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8_t txTone, VoicePromptQueueFlags_T flags); +void anouncePower(float power, VoicePromptQueueFlags_T flags); #endif //VOICE_PROMPT_UTILS_H_INCLUDED \ No newline at end of file diff --git a/openrtx/include/core/voicePrompts.h b/openrtx/include/core/voicePrompts.h index cad3d15c..6114b2ff 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -113,6 +113,8 @@ PROMPT_WATTS, // Watts PROMPT_RECEIVE, // Receive PROMPT_TRANSMIT, // Transmit PROMPT_MODE, // Mode +PROMPT_BANDWIDTH, // bandwidth +PROMPT_POWER, // power PROMPT_SOURCE_ID, // Source ID PROMPT_DEST_ID, // Destination ID PROMPT_DMR_ID, // DMR ID diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 93ca296a..527fcc63 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -73,7 +73,7 @@ VoicePromptQueueFlags_T flags) char numAsStr[16]="\0"; snprintf(numAsStr, 16, "%d", channelIndex); if (strcmp(numAsStr, channel->name) != 0) - vpQueueString(channel->name, flags); + vpQueueString(channel->name, vpAnnounceCommonSymbols); vpPlayIfNeeded(flags); } @@ -132,6 +132,39 @@ void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags) vpPlayIfNeeded(flags); } +void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags) +{ + if (bandwidth > BW_25) + bandwidth = BW_25; // should probably never happen! + + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_BANDWIDTH); + + char* bandwidths[]={"12.5", "20", "25"}; + vpQueueString(bandwidths[bandwidth], vpAnnounceCommonSymbols); + vpQueuePrompt(PROMPT_KILOHERTZ); + + vpPlayIfNeeded(flags); +} + +void anouncePower(float power, VoicePromptQueueFlags_T flags) +{ + vpInitIfNeeded(flags); + + char buffer[16] = "\0"; +//joe + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_POWER); + + snprintf(buffer, 16, "%1.1f", power); + vpQueueString(buffer, vpAnnounceCommonSymbols); + vpQueuePrompt(PROMPT_WATTS); + + vpPlayIfNeeded(flags); +} + void vpAnnounceChannelSummary(channel_t* channel, uint16_t channelIndex, VoicePromptQueueFlags_T flags) { @@ -148,12 +181,19 @@ VoicePromptQueueFlags_T flags) announceFrequencies(channel->rx_frequency , channel->tx_frequency, localFlags); announceRadioMode(channel->mode, localFlags); - if ((channel->mode == OPMODE_FM) && (channel->fm.rxToneEn || channel->fm.txToneEn)) + if (channel->mode == OPMODE_FM) { - announceCTCSS(channel->fm.rxToneEn, channel->fm.rxTone, -channel->fm.txToneEn, channel->fm.txTone, -localFlags); + announceBandwidth(channel->bandwidth, localFlags); + + if (channel->fm.rxToneEn || channel->fm.txToneEn) + { + announceCTCSS(channel->fm.rxToneEn, channel->fm.rxTone, + channel->fm.txToneEn, channel->fm.txTone, + localFlags); + } } + // Todo M17 and DMR info. + anouncePower(channel->power, localFlags); vpPlayIfNeeded(flags); } @@ -261,4 +301,4 @@ void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8 } vpPlayIfNeeded(flags); -} \ No newline at end of file +} diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index e13eb94d..3ef2f1aa 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -772,6 +772,10 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) bool tone_tx_enable = state.channel.fm.txToneEn; bool tone_rx_enable = state.channel.fm.rxToneEn; uint8_t tone_flags = tone_tx_enable << 1 | tone_rx_enable; + VoicePromptQueueFlags_T queueFlags=vpqInit | vpqPlayImmediately; + if (!vpIsPlaying()) + queueFlags |= vpqIncludeDescriptions; + switch(ui_state.input_number) { case 1: @@ -783,7 +787,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) *sync_rtx = true; announceCTCSS(state.channel.fm.rxToneEn, state.channel.fm.rxTone, state.channel.fm.txToneEn, state.channel.fm.txTone, - (vpqInit | vpqPlayImmediately)); + queueFlags); } break; case 2: @@ -807,7 +811,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) *sync_rtx = true; announceCTCSS(state.channel.fm.rxToneEn, state.channel.fm.rxTone, state.channel.fm.txToneEn, state.channel.fm.txTone, - (vpqInit | vpqPlayImmediately)); + queueFlags); } break; case 4: @@ -816,6 +820,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) state.channel.bandwidth++; state.channel.bandwidth %= 3; *sync_rtx = true; + announceBandwidth(state.channel.bandwidth, queueFlags); } break; case 5: @@ -834,6 +839,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) else state.channel.power = 100; *sync_rtx = true; + anouncePower(state.channel.power, queueFlags); break; break; case 7: