Make VFO accessible through voice prompts

Added calls to various voice prompt functions in the UI so that VFO is basically accessible.
1. When entering digits in VFO mode.
2. When digits exceed 3, point will be announced.
3. When user enters sufficient digits to move from RX field to TX field, or if user presses Enter to move to TX field.
4. When both rx and tx frequencies have been completed.
md1702
vk7js 2022-05-11 21:50:51 +10:00 zatwierdzone przez Silvano Seva
rodzic af74978600
commit 46fab4642b
4 zmienionych plików z 35 dodań i 12 usunięć

Wyświetl plik

@ -26,6 +26,7 @@
#include "cps.h"
void announceVFO();
void announceChannelName(channel_t* channel, uint16_t channelIndex, VoicePromptQueueFlags_T flags);
void vpQueueFrequency(freq_t freq);
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags);
void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags);
void announceChannelSummary(channel_t* channel, uint16_t channelIndex,
@ -33,5 +34,5 @@ VoicePromptQueueFlags_T flags);
void AnnounceInputChar(char ch);
void announceInputReceiveOrTransmit(bool tx, VoicePromptQueueFlags_T flags);
void ReplayLastPrompt();
void announceError();
void announceError(VoicePromptQueueFlags_T flags);
#endif //VOICE_PROMPT_UTILS_H_INCLUDED

Wyświetl plik

@ -167,6 +167,7 @@ typedef enum
typedef enum
{
vpqDefault = 0,
vpqInit=0x01, // stop any voice prompts already in progress.
vpqPlayImmediately=0x02, // call play after queue.
vpqIncludeDescriptions=0x04

Wyświetl plik

@ -78,7 +78,7 @@ VoicePromptQueueFlags_T flags)
vpPlayIfNeeded(flags);
}
static void vpQueueFrequency(freq_t freq)
void vpQueueFrequency(freq_t freq)
{
char buffer[16];
int mhz = (freq / 1000000);
@ -185,11 +185,11 @@ void ReplayLastPrompt()
vpPlay();
}
void announceError()
void announceError(VoicePromptQueueFlags_T flags)
{
vpInit();
vpInitIfNeeded(flags);
vpQueueStringTableEntry(&currentLanguage->error);
vpPlay();
vpPlayIfNeeded(flags);
}

Wyświetl plik

@ -570,13 +570,18 @@ int _ui_fsm_loadChannel(int16_t channel_index, bool *sync_rtx) {
void _ui_fsm_confirmVFOInput(bool *sync_rtx)
{
vpInit();
// Switch to TX input
if(ui_state.input_set == SET_RX)
{
ui_state.input_set = SET_TX;
// Reset input position
ui_state.input_position = 0;
announceInputReceiveOrTransmit(true, (vpqInit | vpqPlayImmediately));
// announce the rx frequency just confirmed with Enter.
vpQueueFrequency(ui_state.new_rx_frequency);
// defer playing till the end.
// indicate that the user has moved to the tx freq field.
announceInputReceiveOrTransmit(true, vpqDefault);
}
else if(ui_state.input_set == SET_TX)
{
@ -593,20 +598,32 @@ void _ui_fsm_confirmVFOInput(bool *sync_rtx)
state.channel.rx_frequency = ui_state.new_rx_frequency;
state.channel.tx_frequency = ui_state.new_tx_frequency;
*sync_rtx = true;
announceFrequencies(state.channel.rx_frequency, state.channel.tx_frequency, (vpqInit | vpqPlayImmediately));
// force init to clear any prompts in progress.
// defer play because play is called at the end of the function
//due to above freq queuing.
announceFrequencies(state.channel.rx_frequency, state.channel.tx_frequency, vpqInit);
}
else
announceError();
announceError(vpqInit);
state.ui_screen = MAIN_VFO;
}
vpPlay();
}
void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
{
// Advance input position
ui_state.input_position += 1;
// clear any prompts in progress.
vpInit();
// Save pressed number to calculate frequency and show in GUI
ui_state.input_number = input_getPressedNumber(msg);
// queue the digit just pressed.
vpQueueInteger(ui_state.input_number);
// queue point if user has entered three digits.
if (ui_state.input_position==3)
vpQueuePrompt(PROMPT_POINT);
if(ui_state.input_set == SET_RX)
{
if(ui_state.input_position == 1)
@ -615,7 +632,10 @@ void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency,
ui_state.input_position, ui_state.input_number);
if(ui_state.input_position >= FREQ_DIGITS)
{
{// queue the rx freq just completed.
vpQueueFrequency(ui_state.new_rx_frequency);
/// now queue tx as user has changed fields.
vpQueuePrompt(PROMPT_TRANSMIT);
// Switch to TX input
ui_state.input_set = SET_TX;
// Reset input position
@ -640,10 +660,13 @@ void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
state.channel.rx_frequency = ui_state.new_rx_frequency;
state.channel.tx_frequency = ui_state.new_tx_frequency;
*sync_rtx = true;
// play is called at end.
announceFrequencies(state.channel.rx_frequency, state.channel.tx_frequency, vpqInit);
}
state.ui_screen = MAIN_VFO;
}
}
vpPlay();
}
void _ui_changeBrightness(int variation)
@ -1113,11 +1136,9 @@ void ui_updateFSM(bool *sync_rtx)
ui_state.new_tx_frequency = 0;
// Save pressed number to calculare frequency and show in GUI
ui_state.input_number = input_getPressedNumber(msg);
vpQueueInteger(ui_state.input_number);
vpPlay();
// Calculate portion of the new frequency
ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency,
ui_state.input_position, ui_state.input_number);
ui_state.input_position, ui_state.input_number);
}
}
break;