Added custom dictionary support for common words used in Channel names and contact names (ported from AccessibleGD77).

Added 9 custom word prompts. (One unused).
md1702
vk7js 2022-05-16 21:28:13 +10:00 zatwierdzone przez Silvano Seva
rodzic 537a20eef5
commit a5985dd55d
2 zmienionych plików z 56 dodań i 3 usunięć

Wyświetl plik

@ -151,6 +151,16 @@ PROMPT_BAR, // bar
PROMPT_UNDERLINE, // underline
PROMPT_CARET, // caret
PROMPT_LEFT_BRACE, // left brace
PROMPT_CUSTOM1, // Hotspot
PROMPT_CUSTOM2, // ClearNode
PROMPT_CUSTOM3, // ShariNode
PROMPT_CUSTOM4, // MicroHub
PROMPT_CUSTOM5, // Openspot
PROMPT_CUSTOM6, // repeater
PROMPT_CUSTOM7, // BlindHams
PROMPT_CUSTOM8, // Allstar
PROMPT_CUSTOM9, // parrot
PROMPT_CUSTOM10, // unused
NUM_VOICE_PROMPTS,
} voicePrompt_t;
@ -204,6 +214,12 @@ typedef enum
vpHigh
} VoicePromptVerbosity_T;
typedef struct
{
const char* userWord;
const voicePrompt_t vp;
} userDictEntry;
extern bool vpDataIsLoaded;
extern const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS;
extern VoicePromptVerbosity_T vpLevel;

Wyświetl plik

@ -78,6 +78,20 @@ static vpSequence_t vpCurrentSequence =
uint32_t tableOfContents[VOICE_PROMPTS_TOC_SIZE];
const userDictEntry userDictionary[]=
{
{"hotspot", PROMPT_CUSTOM1}, // Hotspot
{"clearnode", PROMPT_CUSTOM2}, // ClearNode
{"sharinode", PROMPT_CUSTOM3}, // ShariNode
{"microhub", PROMPT_CUSTOM4}, // MicroHub
{"openspot", PROMPT_CUSTOM5}, // Openspot
{"repeater", PROMPT_CUSTOM6}, // repeater
{"blindhams", PROMPT_CUSTOM7}, // BlindHams
{"allstar", PROMPT_CUSTOM8}, // Allstar
{"parrot", PROMPT_CUSTOM9}, // Parrot
{"channel",PROMPT_CHANNEL},
{0, 0}
};
void vpCacheInit(void)
{
@ -203,6 +217,23 @@ void vpQueuePrompt(uint16_t prompt)
}
}
static uint16_t UserDictLookup(char* ptr, int* advanceBy)
{
if (!ptr || !*ptr) return 0;
for (int index=0; userDictionary[index].userWord!=0; ++index)
{
int len=strlen(userDictionary[index].userWord);
if (strncasecmp(userDictionary[index].userWord, ptr, len)==0)
{
*advanceBy=len;
return userDictionary[index].vp;
}
}
return 0;
}
static bool GetSymbolVPIfItShouldBeAnnounced(char symbol,
VoicePromptFlags_T flags, voicePrompt_t* vp)
{
@ -241,9 +272,15 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
while (*promptString != 0)
{
voicePrompt_t vp = PROMPT_SILENCE;
if ((*promptString >= '0') && (*promptString <= '9'))
int advanceBy=0;
voicePrompt_t vp = UserDictLookup(promptString, &advanceBy);
if (vp)
{
vpQueuePrompt(vp);
promptString += advanceBy;
continue;
}
else if ((*promptString >= '0') && (*promptString <= '9'))
{
vpQueuePrompt(*promptString - '0' + PROMPT_0);
}