Added vpLevel and vpPhoneticSpell to settings.

These take up 4 bits with 4 bits reserved for on the fly voice rate.
Not yet hooked up to menus.
This commit is contained in:
vk7js 2022-05-17 20:34:04 +10:00 committed by Silvano Seva
parent 50b29065ae
commit 8fab0b1e8c
4 changed files with 22 additions and 17 deletions

View File

@ -56,6 +56,10 @@ typedef struct
char callsign[10]; // Plaintext callsign, for future use char callsign[10]; // Plaintext callsign, for future use
uint8_t display_timer : 4, // Standby timer uint8_t display_timer : 4, // Standby timer
not_in_use : 4; not_in_use : 4;
uint8_t vpLevel : 3,
vpPhoneticSpell : 1,
vpReserved : 4; // reserved for voice rate on the fly.
} }
__attribute__((packed)) settings_t; __attribute__((packed)) settings_t;
@ -74,7 +78,10 @@ static const settings_t default_settings =
false, // GPS enabled false, // GPS enabled
"", // Empty callsign "", // Empty callsign
TIMER_30S, // 30 seconds TIMER_30S, // 30 seconds
0 // not in use 0, // not in use
0, // vpOff,
0, // phonetic spell off,
0 // not in use.
}; };
#endif /* SETTINGS_H */ #endif /* SETTINGS_H */

View File

@ -200,12 +200,7 @@ typedef enum
vpqPlayImmediately=0x02, // call play after queue. vpqPlayImmediately=0x02, // call play after queue.
vpqIncludeDescriptions=0x04 vpqIncludeDescriptions=0x04
} VoicePromptQueueFlags_T; } 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 typedef enum
{ {
vpNone=0, vpNone=0,

View File

@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <state.h>
#include "core/voicePromptUtils.h" #include "core/voicePromptUtils.h"
@ -174,7 +175,7 @@ VoicePromptQueueFlags_T flags)
// 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=flags & ~(vpqInit | vpqPlayImmediately);
if (vpLevel == vpHigh) if (state.settings.vpLevel == vpHigh)
localFlags |= vpqIncludeDescriptions; localFlags |= vpqIncludeDescriptions;
announceChannelName(channel, channelIndex, localFlags); announceChannelName(channel, channelIndex, localFlags);

View File

@ -23,6 +23,7 @@
#include <ctype.h> #include <ctype.h>
#include "core/voicePrompts.h" #include "core/voicePrompts.h"
#include "ui/UIStrings.h" #include "ui/UIStrings.h"
#include <state.h>
const uint32_t VOICE_PROMPTS_DATA_MAGIC = 0x5056;//'VP' const uint32_t VOICE_PROMPTS_DATA_MAGIC = 0x5056;//'VP'
const uint32_t VOICE_PROMPTS_DATA_VERSION = 0x1000; // v1000 OpenRTX const uint32_t VOICE_PROMPTS_DATA_VERSION = 0x1000; // v1000 OpenRTX
@ -49,7 +50,6 @@ static uint32_t vpFlashDataAddress;// = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + siz
#define Codec2DataBufferSize 2052 #define Codec2DataBufferSize 2052
bool vpDataIsLoaded = false; bool vpDataIsLoaded = false;
VoicePromptVerbosity_T vpLevel = vpHigh;
static bool voicePromptIsActive = false; static bool voicePromptIsActive = false;
// Uninitialized is -1. // Uninitialized is -1.
@ -105,7 +105,7 @@ void vpCacheInit(void)
vpFlashDataAddress = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t) + sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ; vpFlashDataAddress = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t) + sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ;
} }
if (!vpDataIsLoaded) if (!vpDataIsLoaded)
vpLevel = vpNone; state.settings.vpLevel = vpNone;
} }
bool vpCheckHeader(uint32_t *bufferAddress) bool vpCheckHeader(uint32_t *bufferAddress)
@ -203,7 +203,7 @@ void vpInit(void)
void vpQueuePrompt(uint16_t prompt) void vpQueuePrompt(uint16_t prompt)
{ {
if (vpLevel < vpLow) if (state.settings.vpLevel < vpLow)
return; return;
if (voicePromptIsActive) if (voicePromptIsActive)
@ -262,7 +262,7 @@ VoicePromptFlags_T flags, voicePrompt_t* vp)
// This function spells out a string letter by letter. // This function spells out a string letter by letter.
void vpQueueString(char *promptString, VoicePromptFlags_T flags) void vpQueueString(char *promptString, VoicePromptFlags_T flags)
{ {
if (vpLevel < vpLow) if (state.settings.vpLevel < vpLow)
return; return;
if (voicePromptIsActive) if (voicePromptIsActive)
@ -270,6 +270,8 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
vpInit(); vpInit();
} }
if (state.settings.vpPhoneticSpell)
flags|=vpAnnouncePhoneticRendering;
while (*promptString != 0) while (*promptString != 0)
{ {
int advanceBy=0; int advanceBy=0;
@ -327,7 +329,7 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
void vpQueueInteger(int32_t value) void vpQueueInteger(int32_t value)
{ {
if (vpLevel < vpLow) if (state.settings.vpLevel < vpLow)
return; return;
char buf[12] = {0}; // min: -2147483648, max: 2147483647 char buf[12] = {0}; // min: -2147483648, max: 2147483647
@ -341,7 +343,7 @@ void vpQueueInteger(int32_t value)
// NUM_VOICE_PROMPTS + (stringTableStringPtr - currentLanguage->languageName) // NUM_VOICE_PROMPTS + (stringTableStringPtr - currentLanguage->languageName)
void vpQueueStringTableEntry(const char * const *stringTableStringPtr) void vpQueueStringTableEntry(const char * const *stringTableStringPtr)
{ {
if (vpLevel < vpLow) if (state.settings.vpLevel < vpLow)
return; return;
if (stringTableStringPtr == NULL) if (stringTableStringPtr == NULL)
@ -353,7 +355,7 @@ void vpQueueStringTableEntry(const char * const *stringTableStringPtr)
void vpPlay(void) void vpPlay(void)
{ {
if (vpLevel < vpLow) if (state.settings.vpLevel < vpLow)
return; return;
if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0)) if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0))