From 89567cce85d10297caaf10e1496ba14cb78b1215 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Fri, 1 Jan 2021 21:11:22 +0100 Subject: [PATCH] UI: remove screen refresh flag screen refresh is not needed anymore since GUI refresh is already done on demand --- openrtx/include/ui.h | 3 +-- openrtx/src/threads.c | 14 +++++--------- openrtx/src/ui.c | 26 +++++++------------------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/openrtx/include/ui.h b/openrtx/include/ui.h index 9fd30566..5a90167a 100644 --- a/openrtx/include/ui.h +++ b/openrtx/include/ui.h @@ -66,9 +66,8 @@ void ui_updateFSM(event_t event, bool *sync_rtx); /** * This function redraws the GUI based on the last radio state. * @param last_state: A local copy of the previous radio state - * @return true if a screen refresh is needed after the update */ -bool ui_updateGUI(state_t last_state); +void ui_updateGUI(state_t last_state); /** * This function terminates the User Interface. diff --git a/openrtx/src/threads.c b/openrtx/src/threads.c index 04db5de4..2c2ae860 100644 --- a/openrtx/src/threads.c +++ b/openrtx/src/threads.c @@ -127,15 +127,11 @@ static void ui_task(void *arg) } // Redraw GUI based on last state copy - bool renderNeeded = ui_updateGUI(last_state); - - if(renderNeeded) - { - // Lock display mutex and render display - OSMutexPend(&display_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err); - gfx_render(); - OSMutexPost(&display_mutex, OS_OPT_POST_NONE, &os_err); - } + ui_updateGUI(last_state); + // Lock display mutex and render display + OSMutexPend(&display_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err); + gfx_render(); + OSMutexPost(&display_mutex, OS_OPT_POST_NONE, &os_err); // We don't need a delay because we lock on incoming events // TODO: Enable self refresh when a continuous visualization is enabled diff --git a/openrtx/src/ui.c b/openrtx/src/ui.c index d5e1beeb..95cd22fb 100644 --- a/openrtx/src/ui.c +++ b/openrtx/src/ui.c @@ -448,26 +448,22 @@ void _ui_drawMenuList(point_t pos, const char *entries[], } } -bool _ui_drawVFOMain(state_t* last_state) +void _ui_drawVFOMain(state_t* last_state) { gfx_clearScreen(); _ui_drawVFOBackground(); _ui_drawVFOTop(last_state); _ui_drawVFOMiddle(last_state); _ui_drawVFOBottom(); - bool screen_update = true; - return screen_update; } -bool _ui_drawVFOInput(state_t* last_state) +void _ui_drawVFOInput(state_t* last_state) { gfx_clearScreen(); _ui_drawVFOBackground(); _ui_drawVFOTop(last_state); _ui_drawVFOMiddleInput(last_state); _ui_drawVFOBottom(); - bool screen_update = true; - return screen_update; } void _ui_drawMenuTop() @@ -573,7 +569,7 @@ void ui_drawSplashScreen() #endif } -bool _ui_drawLowBatteryScreen() +void _ui_drawLowBatteryScreen() { gfx_clearScreen(); uint16_t bat_width = SCREEN_WIDTH / 2; @@ -593,7 +589,6 @@ bool _ui_drawLowBatteryScreen() FONT_SIZE_6PT, TEXT_ALIGN_CENTER, color_white); - return true; } freq_t _ui_freq_add_digit(freq_t freq, uint8_t pos, uint8_t number) @@ -942,54 +937,47 @@ void ui_updateFSM(event_t event, bool *sync_rtx) } } -bool ui_updateGUI(state_t last_state) +void ui_updateGUI(state_t last_state) { if(!layout_ready) { layout = _ui_calculateLayout(); layout_ready = true; } - // TODO: Improve screen_update logic - bool screen_update = false; // Draw current GUI page switch(last_state.ui_screen) { // VFO main screen case VFO_MAIN: - screen_update = _ui_drawVFOMain(&last_state); + _ui_drawVFOMain(&last_state); break; // VFO frequency input screen case VFO_INPUT: - screen_update = _ui_drawVFOInput(&last_state); + _ui_drawVFOInput(&last_state); break; // Top menu screen case MENU_TOP: _ui_drawMenuTop(); - screen_update = true; break; // Settings menu screen case MENU_SETTINGS: _ui_drawMenuSettings(); - screen_update = true; break; #ifdef HAS_RTC // Time&Date settings screen case SETTINGS_TIMEDATE: _ui_drawSettingsTimeDate(&last_state); - screen_update = true; break; // Time&Date settings screen, edit mode case SETTINGS_TIMEDATE_SET: _ui_drawSettingsTimeDateSet(&last_state); - screen_update = true; break; #endif // Low battery screen case LOW_BAT: - screen_update = _ui_drawLowBatteryScreen(); + _ui_drawLowBatteryScreen(); break; } - return screen_update; } void ui_terminate()