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.
md1702
vk7js 2022-05-17 20:34:04 +10:00 zatwierdzone przez Silvano Seva
rodzic 50b29065ae
commit 8fab0b1e8c
4 zmienionych plików z 22 dodań i 17 usunięć

Wyświetl plik

@ -56,6 +56,10 @@ typedef struct
char callsign[10]; // Plaintext callsign, for future use
uint8_t display_timer : 4, // Standby timer
not_in_use : 4;
uint8_t vpLevel : 3,
vpPhoneticSpell : 1,
vpReserved : 4; // reserved for voice rate on the fly.
}
__attribute__((packed)) settings_t;
@ -74,7 +78,10 @@ static const settings_t default_settings =
false, // GPS enabled
"", // Empty callsign
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 */

Wyświetl plik

@ -200,12 +200,7 @@ 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,

Wyświetl plik

@ -20,7 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <state.h>
#include "core/voicePromptUtils.h"
static void vpInitIfNeeded(VoicePromptQueueFlags_T flags)
@ -174,7 +175,7 @@ VoicePromptQueueFlags_T flags)
// mask off init and play because this function will handle init and play.
VoicePromptQueueFlags_T localFlags=flags & ~(vpqInit | vpqPlayImmediately);
if (vpLevel == vpHigh)
if (state.settings.vpLevel == vpHigh)
localFlags |= vpqIncludeDescriptions;
announceChannelName(channel, channelIndex, localFlags);

Wyświetl plik

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