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.
This commit is contained in:
vk7js 2022-05-18 15:55:49 +10:00 committed by Silvano Seva
parent 62ae110a19
commit 2102c15602
2 changed files with 13 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <interfaces/delays.h>
#include <interfaces/cps_io.h>
#include <interfaces/gps.h>
#include <voicePrompts.h>
#include <graphics.h>
#include <openrtx.h>
#include <threads.h>
@ -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

View File

@ -21,6 +21,7 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "interfaces/keyboard.h"
#include "core/voicePrompts.h"
#include "ui/UIStrings.h"
#include <state.h>
@ -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)