From 537a20eef511a8b6d0addd70bbf6a542d1e7c74b Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Sat, 14 May 2022 15:54:51 +1000 Subject: [PATCH] Add prompts for brightness and squelch Added support for announcing macros for adjusting brightness and squelch. Added voiceprompt for squelch. --- openrtx/include/core/voicePromptUtils.h | 3 +++ openrtx/include/core/voicePrompts.h | 25 +++++++++++++++++++++--- openrtx/src/core/voicePromptUtils.c | 26 ++++++++++++++++++++++++- openrtx/src/ui/ui.c | 5 +++++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index 3c99242f..aaab8a59 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -58,4 +58,7 @@ 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); +void announceBrightness(uint8_t brightness, VoicePromptQueueFlags_T flags); +void announceSquelch(uint8_t squelch, 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 6114b2ff..a9c97b70 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -115,6 +115,7 @@ PROMPT_TRANSMIT, // Transmit PROMPT_MODE, // Mode PROMPT_BANDWIDTH, // bandwidth PROMPT_POWER, // power +PROMPT_SQUELCH, // squelch PROMPT_SOURCE_ID, // Source ID PROMPT_DEST_ID, // Destination ID PROMPT_DMR_ID, // DMR ID @@ -156,7 +157,13 @@ NUM_VOICE_PROMPTS, // PROMPT_VOICE_NAME is always the very last prompt after the indexed prompts // from the strings table. #define PROMPT_VOICE_NAME (NUM_VOICE_PROMPTS + (sizeof(stringsTable_t)/sizeof(char*))) - +/* +These flags govern how vpQueueString operates. +For example, when editing, it is desireable to hear spaces, capitals and +extended symbols. +When just arrowing through menus, spaces, extended symbols etc should not be +announced. +*/ typedef enum { vpAnnounceCaps=0x01, @@ -167,7 +174,14 @@ typedef enum vpAnnounceASCIIValueForUnknownChars=0x20, vpAnnouncePhoneticRendering=0x40, } VoicePromptFlags_T; - +/* +These queuing flags determine if speech is interrupted, played immediately, whether prompts are queued for values, etc. +They are necessary because for example if you call the announceXX functions +consecutively, it is only desireable to initially stop speech in progress +and only play after the last prompt is queued. +If however calling an announceXX function in isolation, normally any prompt in +progress should be interrupted and play should be called immediately. +*/ typedef enum { vpqDefault = 0, @@ -175,7 +189,12 @@ typedef enum vpqPlayImmediately=0x02, // call play after queue. vpqIncludeDescriptions=0x04 } VoicePromptQueueFlags_T; - +/* +These values correspond to prompts in the wordlistXX.csv file in the +voicePromptGenerator subproject. +They must not be reordered. +They correspond to prompts for which there are no string table entries. +*/ typedef enum { vpNone=0, diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 527fcc63..95ab7b4d 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -165,7 +165,7 @@ void anouncePower(float power, VoicePromptQueueFlags_T flags) vpPlayIfNeeded(flags); } -void vpAnnounceChannelSummary(channel_t* channel, uint16_t channelIndex, +void announceChannelSummary(channel_t* channel, uint16_t channelIndex, VoicePromptQueueFlags_T flags) { if (!channel) return; @@ -302,3 +302,27 @@ void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8 vpPlayIfNeeded(flags); } + +void announceBrightness(uint8_t brightness, VoicePromptQueueFlags_T flags) +{ + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueueStringTableEntry(¤tLanguage->brightness); + + vpQueueInteger(brightness); + + vpPlayIfNeeded(flags); +} + +void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags) +{ + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_SQUELCH); + + vpQueueInteger(squelch); + + vpPlayIfNeeded(flags); +} \ No newline at end of file diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index e9a2c6cb..271bcf5e 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -845,9 +845,11 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) break; case 7: _ui_changeBrightness(-5); + announceBrightness(state.settings.brightness, queueFlags); break; case 8: _ui_changeBrightness(+5); + announceBrightness(state.settings.brightness, queueFlags); break; } @@ -855,6 +857,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) if(msg.keys & KNOB_LEFT || msg.keys & KNOB_RIGHT) { state.settings.sqlLevel = platform_getChSelector() - 1; *sync_rtx = true; + announceSquelch(state.settings.sqlLevel, queueFlags); } if(msg.keys & KEY_LEFT || msg.keys & KEY_DOWN) @@ -867,6 +870,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) { state.settings.sqlLevel -= 1; *sync_rtx = true; + announceSquelch(state.settings.sqlLevel, queueFlags); } } @@ -880,6 +884,7 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) { state.settings.sqlLevel += 1; *sync_rtx = true; + announceSquelch(state.settings.sqlLevel, queueFlags); } } }