diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index 34e3355f..0f79236b 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -202,6 +202,13 @@ void vp_announceSettingsInt(const char* const* stringTableStringPtr, */ void vp_announceScreen(uint8_t ui_screen); +/** + * This function is called from ui_updateFSM to speak string buffers. + */ +void vp_announceBuffer(const char* const* stringTableStringPtr, bool editMode, + const char* buffer); + + /** * */ diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 929ffaf1..35a5b583 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -271,8 +271,7 @@ void vp_announceInputChar(const char ch) vp_flush(); - uint8_t flags = vpAnnounceCaps - | vpAnnounceSpace + uint8_t flags = vpAnnounceSpace | vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols; @@ -749,9 +748,38 @@ void vp_announceScreen(uint8_t ui_screen) case SETTINGS_TIMEDATE: vp_announceSettingsTimeDate(); break; + case SETTINGS_M17: + vp_announceBuffer(¤tLanguage->callsign, + false, state.settings.callsign); + break; } } +void vp_announceBuffer(const char* const* stringTableStringPtr, bool editMode, + const char* buffer) +{ + bool isPlaying=vp_isPlaying(); + + vp_flush(); + + if (!isPlaying) + { + vp_queueStringTableEntry(stringTableStringPtr); + + if (editMode) + vp_queuePrompt(PROMPT_EDIT); + } + + vpFlags_t flags= vpAnnounceCommonSymbols; + // add edit mode flags to adjust what is spoken. + if (editMode) + flags |= vpAnnounceLessCommonSymbols | vpAnnounceSpace | vpAnnounceASCIIValueForUnknownChars; + + vp_queueString(buffer, flags); + + vp_play(); +} + vpQueueFlags_t vp_getVoiceLevelQueueFlags() { uint8_t vpLevel = state.settings.vpLevel; diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index e436327f..65090d27 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1840,6 +1840,8 @@ void ui_updateFSM(bool *sync_rtx) strncpy(state.settings.callsign, ui_state.new_callsign, 10); ui_state.edit_mode = false; *sync_rtx = true; + vp_announceBuffer(¤tLanguage->callsign, + false, state.settings.callsign); } else if(msg.keys & KEY_ESC) // Discard selected callsign and disable input mode @@ -1849,6 +1851,12 @@ void ui_updateFSM(bool *sync_rtx) _ui_textInputDel(ui_state.new_callsign); else if(input_isNumberPressed(msg)) _ui_textInputKeypad(ui_state.new_callsign, 9, msg, true); + else if (msg.long_press && (msg.keys & KEY_F1) && (state.settings.vpLevel > vpBeep)) + { + vp_announceBuffer(¤tLanguage->callsign, + true, ui_state.new_callsign); + f1Handled=true; + } } else { @@ -1858,6 +1866,8 @@ void ui_updateFSM(bool *sync_rtx) ui_state.edit_mode = true; // Reset text input variables _ui_textInputReset(ui_state.new_callsign); + vp_announceBuffer(¤tLanguage->callsign, + true, ui_state.new_callsign); } else if(msg.keys & KEY_ESC) _ui_menuBack(MENU_SETTINGS);