From 99408a54556c486ea310ac8a0e755460c67b63c0 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Fri, 26 Aug 2022 17:03:13 +0200 Subject: [PATCH] Added function to announce generic on/off toggle settings. --- openrtx/include/core/voicePromptUtils.h | 6 ++++++ openrtx/src/core/voicePromptUtils.c | 13 +++++++++++++ openrtx/src/ui/ui.c | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index 10908fdf..d15e96ec 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -193,6 +193,12 @@ void vp_announceSettingsTimeDate(); */ void vp_announceSettingsVoiceLevel(const vpQueueFlags_t flags); +/** + * This is called to speak generic settings on/off toggles. + */ +void vp_announceSettingsOnOffToggle(const char* const* stringTableStringPtr, + const vpQueueFlags_t flags, bool val); + /** * */ diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index d5cb6d1f..cd8fbc05 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -718,6 +718,19 @@ void vp_announceSettingsVoiceLevel(const vpQueueFlags_t flags) playIfNeeded(flags); } +void vp_announceSettingsOnOffToggle(const char* const* stringTableStringPtr, + const vpQueueFlags_t flags, bool val) +{ + clearCurrPromptIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vp_queueStringTableEntry(stringTableStringPtr); + + vp_queueStringTableEntry(val ? ¤tLanguage->on : ¤tLanguage->off); + + playIfNeeded(flags); +} + 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 1d80b06c..b3a4b556 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -759,6 +759,10 @@ static void _ui_changeVoiceLevel(int variation) static void _ui_changePhoneticSpell(bool newVal) { state.settings.vpPhoneticSpell = newVal ? 1 : 0; + + vp_announceSettingsOnOffToggle(¤tLanguage->phonetic, + vp_getVoiceLevelQueueFlags(), + state.settings.vpPhoneticSpell); } static bool _ui_checkStandby(long long time_since_last_event)