Began work on the macros screen.

Toggling tone or enabling/disabling (macros 1 and 2) now supported.
Added new voice prompt for tone.
This commit is contained in:
vk7js 2022-05-14 12:12:06 +10:00 committed by Silvano Seva
parent 4098baa5a8
commit 68926a72c4
4 changed files with 66 additions and 1 deletions

View File

@ -24,6 +24,19 @@
#include "voicePrompts.h"
#include "ui/UIStrings.h"
#include "cps.h"
/*
Please Note!
Many of the functions take queue flags because sometimes messages must be
played in sequence (i.e. the announceXX functions may be called one after the
other) and thus the init must only be sent prior to the first message queued
and the play must only be invoked after the last message queued.
When an announceXX function is called in isolation, vpqInit|vpqPlayImmediately
should be used to ensure that the message interupts the current prompt and
plays immediately.
*/
void announceVFO();
void announceChannelName(channel_t* channel, uint16_t channelIndex, VoicePromptQueueFlags_T flags);
void vpQueueFrequency(freq_t freq);
@ -42,5 +55,5 @@ passed in and if so, queues it, but if not, just spells the text
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);
#endif //VOICE_PROMPT_UTILS_H_INCLUDED

View File

@ -117,6 +117,7 @@ PROMPT_SOURCE_ID, // Source ID
PROMPT_DEST_ID, // Destination ID
PROMPT_DMR_ID, // DMR ID
PROMPT_TALKGROUP, // Talk group
PROMPT_TONE, // tone
PROMPT_CHARACTER, // character
PROMPT_SPACE, // space
PROMPT_PERCENT, // Percent

View File

@ -210,3 +210,48 @@ void announceText( char* text, VoicePromptQueueFlags_T flags)
vpPlayIfNeeded(flags);
}
void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8_t txTone, VoicePromptQueueFlags_T flags)
{
vpInitIfNeeded(flags);
if (!rxToneEnabled && !txToneEnabled)
{
vpQueuePrompt(PROMPT_TONE);
vpQueueStringTableEntry(&currentLanguage->off);
vpPlayIfNeeded(flags);
return;
}
char buffer[16] = "\0";
// If the rx and tx tones are the same and both are enabled, just say Tone.
if ((rxToneEnabled && txToneEnabled) && (rxTone == txTone))
{
vpQueuePrompt(PROMPT_TONE);
snprintf(buffer, 16, "%3.1f", ctcss_tone[rxTone]/10.0f);
vpQueueString(buffer, vpqDefault);
vpQueuePrompt(PROMPT_HERTZ);
vpPlayIfNeeded(flags);
return;
}
// speak the individual rx and tx tones.
if (rxToneEnabled)
{
vpQueuePrompt(PROMPT_RECEIVE);
vpQueuePrompt(PROMPT_TONE);
snprintf(buffer, 16, "%3.1f", ctcss_tone[rxTone]/10.0f);
vpQueueString(buffer, vpqDefault);
vpQueuePrompt(PROMPT_HERTZ);
}
if (txToneEnabled)
{
vpQueuePrompt(PROMPT_TRANSMIT);
vpQueuePrompt(PROMPT_TONE);
snprintf(buffer, 16, "%3.1f", ctcss_tone[txTone]/10.0f);
vpQueueString(buffer, vpqDefault);
vpQueuePrompt(PROMPT_HERTZ);
}
vpPlayIfNeeded(flags);
}

View File

@ -781,6 +781,9 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
state.channel.fm.txTone %= MAX_TONE_INDEX;
state.channel.fm.rxTone = state.channel.fm.txTone;
*sync_rtx = true;
announceCTCSS(state.channel.fm.rxToneEn, state.channel.fm.rxTone,
state.channel.fm.txToneEn, state.channel.fm.txTone,
(vpqInit | vpqPlayImmediately));
}
break;
case 2:
@ -802,6 +805,9 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
state.channel.fm.txToneEn = tone_tx_enable;
state.channel.fm.rxToneEn = tone_rx_enable;
*sync_rtx = true;
announceCTCSS(state.channel.fm.rxToneEn, state.channel.fm.rxTone,
state.channel.fm.txToneEn, state.channel.fm.txTone,
(vpqInit | vpqPlayImmediately));
}
break;
case 4: