From f26afc42e548f9c715c90dbfffa24f3e8778b6fc Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Wed, 26 Oct 2022 16:13:02 +0200 Subject: [PATCH] Small reorganization and cleanup of splash screen code, fixed bug causing audio path for voice prompts never being released at vp end --- openrtx/src/core/openrtx.c | 4 ---- openrtx/src/core/threads.c | 5 ++++- openrtx/src/core/voicePrompts.c | 2 +- openrtx/src/ui/ui.c | 12 +++--------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/openrtx/src/core/openrtx.c b/openrtx/src/core/openrtx.c index 9338ef26..8de57d02 100644 --- a/openrtx/src/core/openrtx.c +++ b/openrtx/src/core/openrtx.c @@ -68,7 +68,6 @@ void openrtx_init() // Display splash screen, turn on backlight after a suitable time to // hide random pixels during render process ui_drawSplashScreen(true); - vp_announceSplashScreen(); gfx_render(); sleepFor(0u, 30u); platform_setBacklightLevel(state.settings.brightness); @@ -78,9 +77,6 @@ void openrtx_init() state.gpsDetected = gps_detect(1000); if(state.gpsDetected) gps_init(9600); #endif - - // Keep the splash screen for 1 second - sleepFor(1u, 0u); } void *openrtx_run() diff --git a/openrtx/src/core/threads.c b/openrtx/src/core/threads.c index 753b054f..ca48154c 100644 --- a/openrtx/src/core/threads.c +++ b/openrtx/src/core/threads.c @@ -56,9 +56,12 @@ void *ui_threadFunc(void *arg) bool sync_rtx = true; long long time = 0; - // Load initial state and perform a GUI draw + // Load initial state and update the UI ui_saveState(); ui_updateGUI(); + + // Keep the splash screen for one second before rendering the new UI screen + sleepFor(1u, 0u); gfx_render(); while(state.devStatus != SHUTDOWN) diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index 74bfcae0..06c38632 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -627,11 +627,11 @@ void vp_tick() // see if we've finished. if(vpCurrentSequence.pos == vpCurrentSequence.length) { - disableSpkOutput(); voicePromptActive = false; vpCurrentSequence.pos = 0; vpCurrentSequence.c2DataIndex = 0; vpCurrentSequence.c2DataLength = 0; + disableSpkOutput(); codec_stop(); } } diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 00233bdc..f9798de1 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1116,21 +1116,15 @@ void ui_drawSplashScreen(bool centered) { gfx_clearScreen(); point_t splash_origin = {0,0}; - #ifdef OLD_SPLASH - if(centered) - splash_origin.y = SCREEN_HEIGHT / 2 + 6; - else - splash_origin.y = SCREEN_HEIGHT / 4; - gfx_print(splash_origin, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, - currentLanguage->openRTX); - #else + if(centered) splash_origin.y = SCREEN_HEIGHT / 2 - 6; else splash_origin.y = SCREEN_HEIGHT / 5; gfx_print(splash_origin, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, "O P N\nR T X"); - #endif + + vp_announceSplashScreen(); } void ui_saveState()