From eb89f5a55a97951063f071be3d4b297170ce6e70 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Fri, 9 Sep 2022 21:07:28 +1000 Subject: [PATCH] Now play generic beep on any key press as well as different tones when navigating the menu, when menu item wraps, and when function key latches and unlatches if voice prompt level is set to beep. --- openrtx/src/core/voicePromptUtils.c | 4 ++-- openrtx/src/core/voicePrompts.c | 5 +++-- openrtx/src/ui/ui.c | 3 +++ platform/targets/MD-UV3x0/platform.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index ce838c38..11c56de6 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -914,8 +914,8 @@ void vp_playMenuBeepIfNeeded(bool firstItem) if (state.settings.vpLevel < vpBeep) return; if (firstItem) - vp_beep(500, 5); + vp_beep(500, 3); else - vp_beep(1000, 5); + vp_beep(1000, 3); } diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index 2c2360c3..7c675c37 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -532,6 +532,7 @@ bool vp_sequenceNotEmpty() return (vpCurrentSequence.length > 0); } +// Duration seems to be in tenths of a second. void vp_beep(uint16_t freq, uint16_t duration) { if (state.settings.vpLevel < vpBeep) @@ -541,8 +542,8 @@ void vp_beep(uint16_t freq, uint16_t duration) if (currentBeepDuration) return ; // avoid extra long beeps! - if (duration > 2000) - duration=2000; + if (duration > 20) + duration=20; currentBeepDuration=duration; audio_enableAmp(); diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 8cc7ed59..fa730b71 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1966,6 +1966,9 @@ 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)) + vp_beep(750, 3); } else if(event.type == EVENT_STATUS) { diff --git a/platform/targets/MD-UV3x0/platform.c b/platform/targets/MD-UV3x0/platform.c index d56eb549..c4fcf314 100644 --- a/platform/targets/MD-UV3x0/platform.c +++ b/platform/targets/MD-UV3x0/platform.c @@ -184,7 +184,7 @@ void platform_ledOff(led_t led) void platform_beepStart(uint16_t freq) { - toneGen_beepOn((float)freq, 128, 0); + toneGen_beepOn((float)freq, 64, 0); } void platform_beepStop()