diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index de1d76a9..b7469678 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -208,6 +208,11 @@ void vp_announceScreen(uint8_t ui_screen); void vp_announceBuffer(const char* const* stringTableStringPtr, bool editMode, bool callsign, const char* buffer); +/** + * This function is called from ui_updateFSM to speak display timer changes. + */ +void vp_announceDisplayTimer(); + /** * */ diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 65c5f7a5..c009ba7f 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -787,6 +787,64 @@ void vp_announceBuffer(const char* const* stringTableStringPtr, vp_play(); } +void vp_announceDisplayTimer() +{ + bool isPlaying=vp_isPlaying(); + + vp_flush(); + + if (!isPlaying) + vp_queueStringTableEntry(¤tLanguage->timer); + uint8_t seconds = 0; + uint8_t minutes = 0; + + switch (state.settings.display_timer) + { + case TIMER_OFF: + seconds=0; + break; + case TIMER_5S: + case TIMER_10S: + case TIMER_15S: + case TIMER_20S: + case TIMER_25S: + case TIMER_30S: + seconds=state.settings.display_timer*5; + break; + case TIMER_1M: + case TIMER_2M: + case TIMER_3M: + case TIMER_4M: + case TIMER_5M: + minutes = (state.settings.display_timer - (TIMER_1M - 1)); + break; + case TIMER_15M: + case TIMER_30M: + case TIMER_45M: + minutes = 15 * (state.settings.display_timer - (TIMER_15M - 1)); + break; + case TIMER_1H: + minutes = 60; + break; + } + if (seconds==0 && minutes==0) + { + vp_queueStringTableEntry(¤tLanguage->off); + } + else if (seconds > 0) + { + vp_queueInteger(seconds); + vp_queuePrompt(PROMPT_SECONDS); + } + else if (minutes > 0) + { + vp_queueInteger(minutes); + vp_queuePrompt(PROMPT_MINUTES); + } + + 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 364b4de6..574cef9c 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1760,6 +1760,7 @@ void ui_updateFSM(bool *sync_rtx) #endif case D_TIMER: _ui_changeTimer(-1); + vp_announceDisplayTimer(); break; default: state.ui_screen = SETTINGS_DISPLAY; @@ -1784,6 +1785,7 @@ void ui_updateFSM(bool *sync_rtx) #endif case D_TIMER: _ui_changeTimer(+1); + vp_announceDisplayTimer(); break; default: state.ui_screen = SETTINGS_DISPLAY;