From da7dfe63b28e6d03bee47fd538bb50e64ea123a8 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Fri, 9 Sep 2022 23:24:08 +1000 Subject: [PATCH] Avoid calling beep if we know the voice will announce something since it will be canceled and most likely generate an unwanted click. --- openrtx/src/core/voicePromptUtils.c | 4 +++- openrtx/src/ui/ui.c | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 11c56de6..e8c61373 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -911,7 +911,9 @@ vpQueueFlags_t vp_getVoiceLevelQueueFlags() void vp_playMenuBeepIfNeeded(bool firstItem) { - if (state.settings.vpLevel < vpBeep) +// Since menus talk at levels above beep, there's no need to run this or you'll +// get an unwanted click. + if (state.settings.vpLevel != vpBeep) return; if (firstItem) vp_beep(500, 3); diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index fa730b71..fda9cbb9 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -279,13 +279,13 @@ static void ReleaseFunctionLatchIfNeeded() return; functionLatchTimer = 0; - vp_beep(400, 10); + vp_beep(400, 7); } static void SetFunctionLatchTimer() { functionLatchTimer= getTick() + FUNCTION_LATCH_TIMEOUT; - vp_beep(800, 10); + vp_beep(800, 7); } static bool FunctionKeyIsLatched() @@ -1966,8 +1966,10 @@ void ui_updateFSM(bool *sync_rtx) // All other cases are handled as needed. vp_announceScreen(state.ui_screen); } - // generic beep for any key - if ((msg.keys &0xffff) && (state.settings.vpLevel >= vpBeep)) + // generic beep for any key if beep is enabled. + // At vp levels higher than beep, keys will generate voice so no need + // to beep or you'll get an unwanted click. + if ((msg.keys &0xffff) && (state.settings.vpLevel == vpBeep)) vp_beep(750, 3); } else if(event.type == EVENT_STATUS)