diff --git a/openrtx/include/core/voicePrompts.h b/openrtx/include/core/voicePrompts.h index d510a4e2..5c0c8cd9 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -172,8 +172,18 @@ typedef enum vpqIncludeDescriptions=0x04 } VoicePromptQueueFlags_T; +typedef enum +{ + vpNone=0, + vpBeep, + vpLow, + vpMedium, + vpHigh +} VoicePromptVerbosity_T; + extern bool voicePromptDataIsLoaded; extern const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS; +extern VoicePromptVerbosity_T vpLevel; // Loads just the TOC from Flash and stores in RAM for fast access. void vpCacheInit(void); // event driven to play a voice prompt in progress. diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 8db7d764..9fda3656 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -140,8 +140,10 @@ VoicePromptQueueFlags_T flags) vpInitIfNeeded(flags); // mask off init and play because this function will handle init and play. - VoicePromptQueueFlags_T localFlags=flags & vpqIncludeDescriptions; - + VoicePromptQueueFlags_T localFlags=flags & ~(vpqInit | vpqPlayImmediately); + if (vpLevel == vpHigh) + localFlags |= vpqIncludeDescriptions; + announceChannelName(channel, channelIndex, localFlags); announceFrequencies(channel->rx_frequency , channel->tx_frequency, localFlags); announceRadioMode(channel->mode, localFlags); diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index 4a9065f4..56959b19 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -49,6 +49,8 @@ static uint32_t vpFlashDataAddress;// = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + siz #define Codec2DataBufferSize 2052 bool voicePromptDataIsLoaded = false; + VoicePromptVerbosity_T vpLevel = vpHigh; + static bool voicePromptIsActive = false; // Uninitialized is -1. static int promptDataPosition = -1; @@ -186,6 +188,9 @@ void vpInit(void) void vpQueuePrompt(uint16_t prompt) { + if (vpLevel < vpLow) + return; + if (voicePromptIsActive) { vpInit(); @@ -225,6 +230,9 @@ VoicePromptFlags_T flags, voicePrompt_t* vp) // This function spells out a string letter by letter. void vpQueueString(char *promptString, VoicePromptFlags_T flags) { + if (vpLevel < vpLow) + return; + if (voicePromptIsActive) { vpInit(); @@ -281,6 +289,9 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags) void vpQueueInteger(int32_t value) { + if (vpLevel < vpLow) + return; + char buf[12] = {0}; // min: -2147483648, max: 2147483647 snprintf(buf, 12, "%d", value); vpQueueString(buf, 0); @@ -292,6 +303,9 @@ void vpQueueInteger(int32_t value) // NUM_VOICE_PROMPTS + (stringTableStringPtr - currentLanguage->languageName) void vpQueueStringTableEntry(const char * const *stringTableStringPtr) { + if (vpLevel < vpLow) + return; + if (stringTableStringPtr == NULL) { return; @@ -301,6 +315,9 @@ void vpQueueStringTableEntry(const char * const *stringTableStringPtr) void vpPlay(void) { + if (vpLevel < vpLow) + return; + if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0)) { voicePromptIsActive = true;// Start the playback