From 2102c15602a51b368814ee05e9170a12a0b520a2 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Wed, 18 May 2022 15:55:49 +1000 Subject: [PATCH] Hook up voice prompts in main startup routine 1. Call vpCacheInit() from the main startup routine. 2. If voice prompts are successfully loaded, and the hash key is held down, and the vp level is less than low, vp level is set to high. 3. If voice prompts are not loaded, and the level was set to something higher than beep, it is set to beep so that at a minimum, the user gets some beep feedback. If it was already set to off, nothing is changed. --- openrtx/src/core/openrtx.c | 2 ++ openrtx/src/core/voicePrompts.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/openrtx/src/core/openrtx.c b/openrtx/src/core/openrtx.c index 8f3096af..7020e446 100644 --- a/openrtx/src/core/openrtx.c +++ b/openrtx/src/core/openrtx.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ void openrtx_init() gfx_init(); // Initialize display and graphics driver kbd_init(); // Initialize keyboard driver ui_init(); // Initialize user interface + vpCacheInit(); // Checks to see if voice prompts are loaded and initializes them #ifdef SCREEN_CONTRAST display_setContrast(state.settings.contrast); #endif diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index c7b57775..45ef3b22 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -21,6 +21,7 @@ #include #include #include +#include "interfaces/keyboard.h" #include "core/voicePrompts.h" #include "ui/UIStrings.h" #include @@ -104,8 +105,16 @@ void vpCacheInit(void) vpDataIsLoaded = false; //SPI_Flash_read(VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t), (uint8_t *)&tableOfContents, sizeof(uint32_t) * VOICE_PROMPTS_TOC_SIZE); vpFlashDataAddress = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t) + sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ; } - if (!vpDataIsLoaded) - state.settings.vpLevel = vpNone; + if (vpDataIsLoaded) + {// if the hash key is down, set vpLevel to high, if beep or less. + if ((kbd_getKeys() & KEY_HASH) && (state.settings.vpLevel <= vpBeep)) + state.settings.vpLevel = vpHigh; + } + else + { // ensure we at least have beeps in the event no voice prompts are loaded. + if (state.settings.vpLevel > vpBeep) + state.settings.vpLevel = vpBeep; + } } bool vpCheckHeader(uint32_t *bufferAddress)