Moved beep definitions into header beeps.h.

md1702
vk7js 2022-09-11 19:38:40 +10:00 zatwierdzone przez Silvano Seva
rodzic 853db877e9
commit dc285ab023
3 zmienionych plików z 42 dodań i 7 usunięć

Wyświetl plik

@ -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 <http://www.gnu.org/licenses/> *
***************************************************************************/
#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

Wyświetl plik

@ -30,7 +30,7 @@
#include <string.h>
#include <utils.h>
#include <ui.h>
#include <beeps.h>
#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);
}

Wyświetl plik

@ -79,6 +79,7 @@
#include <utils.h>
#include <hwconfig.h>
#include <voicePromptUtils.h>
#include <beeps.h>
#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();