Add prompts for brightness and squelch

Added support for announcing macros for adjusting brightness and squelch.
Added voiceprompt for squelch.
This commit is contained in:
vk7js 2022-05-14 15:54:51 +10:00 committed by Silvano Seva
parent e74eccfffd
commit 537a20eef5
4 changed files with 55 additions and 4 deletions

View File

@ -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

View File

@ -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,

View File

@ -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(&currentLanguage->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);
}

View File

@ -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);
}
}
}