diff --git a/openrtx/include/core/beeps.h b/openrtx/include/core/beeps.h new file mode 100644 index 00000000..7099f08d --- /dev/null +++ b/openrtx/include/core/beeps.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * + * Joseph Stephen VK7JS * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ +#ifndef BEEPS_H_INCLUDED +#define BEEPS_H_INCLUDED +// Duration in tenths of a second. +#define SHORT_BEEP 3 +#define LONG_BEEP 7 + +// Beep frequencies +#define BEEP_MENU_FIRST_ITEM 500 +#define BEEP_MENU_ITEM 1000 +#define BEEP_FUNCTION_LATCH_ON 800 +#define BEEP_FUNCTION_LATCH_OFF 400 +#define BEEP_KEY_GENERIC 750 + +#endif // BEEPS_H_INCLUDED \ No newline at end of file diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index e8c61373..2ce1a07e 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -30,7 +30,7 @@ #include #include #include - +#include #include "interfaces/cps_io.h" static void clearCurrPromptIfNeeded(const vpQueueFlags_t flags) @@ -916,8 +916,8 @@ void vp_playMenuBeepIfNeeded(bool firstItem) if (state.settings.vpLevel != vpBeep) return; if (firstItem) - vp_beep(500, 3); + vp_beep(BEEP_MENU_FIRST_ITEM, SHORT_BEEP); else - vp_beep(1000, 3); + vp_beep(BEEP_MENU_ITEM, SHORT_BEEP); } diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 26410624..bed61eba 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -79,6 +79,7 @@ #include #include #include +#include #define FUNCTION_LATCH_TIMEOUT 3000 @@ -280,13 +281,13 @@ static void ReleaseFunctionLatchIfNeeded() return; functionLatchTimer = 0; - vp_beep(400, 7); + vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP); } static void SetFunctionLatchTimer() { functionLatchTimer= getTick() + FUNCTION_LATCH_TIMEOUT; - vp_beep(800, 7); + vp_beep(BEEP_FUNCTION_LATCH_ON, LONG_BEEP); } static bool FunctionKeyIsLatched() @@ -1967,11 +1968,11 @@ void ui_updateFSM(bool *sync_rtx) // All other cases are handled as needed. vp_announceScreen(state.ui_screen); } - // generic beep for any key if beep is enabled. + // generic beep for any keydown 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); + vp_beep(BEEP_KEY_GENERIC, SHORT_BEEP); // If we exit and re-enter the same menu, we want to ensure it speaks. if (msg.keys & KEY_ESC) _ui_reset_menu_anouncement_tracking();