From 4098baa5a863e444fbfd043c94dc814f2edfc5fb Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Fri, 13 May 2022 15:22:28 +1000 Subject: [PATCH] When speaking a menu and its value, only speak the name if a prompt is not in progress. --- openrtx/src/ui/ui_menu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index 34697aee..62a6e4fb 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -93,9 +93,17 @@ static void announceMenuItemIfNeeded(char* name, char* value) if (!DidSelectedMenuItemChange(name, value)) return; - announceText(name, vpqInit); + // See if we are already in the middle of speaking a menu item. + // e.g. when changing a value with left or right, we don't want to repeat the + // prompt if arrowing rapidly. + bool voicePromptWasPlaying=vpIsPlaying(); + // Stop any prompt in progress and clear the buffer. + vpInit(); + // If no value is supplied, or, no prompt is in progress, announce the name. + if (!voicePromptWasPlaying || !value || !*value) + announceText(name, vpqDefault); - if (value && *value) + if (value && *value) announceText(name, vpqDefault); vpPlay();