Small optimisation of UI management: perform an update and render of the graphics only when necessary
This commit is contained in:
parent
3ab36f3738
commit
b26d783429
|
|
@ -243,8 +243,10 @@ void ui_updateFSM(bool *sync_rtx);
|
|||
|
||||
/**
|
||||
* This function redraws the GUI based on the last radio state.
|
||||
*
|
||||
* @return true if GUI has been updated and a screen render is necessary.
|
||||
*/
|
||||
void ui_updateGUI();
|
||||
bool ui_updateGUI();
|
||||
|
||||
/**
|
||||
* Push an event to the UI event queue.
|
||||
|
|
|
|||
|
|
@ -100,9 +100,11 @@ void *ui_task(void *arg)
|
|||
sync_rtx = false;
|
||||
}
|
||||
|
||||
// Update UI and render on screen
|
||||
ui_updateGUI();
|
||||
gfx_render();
|
||||
// Update UI and render on screen, if necessary
|
||||
if(ui_updateGUI() == true)
|
||||
{
|
||||
gfx_render();
|
||||
}
|
||||
|
||||
// 40Hz update rate for keyboard and UI
|
||||
time += 25;
|
||||
|
|
|
|||
|
|
@ -722,6 +722,7 @@ void _ui_enterStandby()
|
|||
return;
|
||||
|
||||
standby = true;
|
||||
redraw_needed = false;
|
||||
platform_setBacklightLevel(0);
|
||||
}
|
||||
|
||||
|
|
@ -733,6 +734,7 @@ bool _ui_exitStandby(long long now)
|
|||
return false;
|
||||
|
||||
standby = false;
|
||||
redraw_needed = true;
|
||||
platform_setBacklightLevel(state.settings.brightness);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -945,6 +947,11 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
event_t event = evQueue[evQueue_rdPos];
|
||||
evQueue_rdPos = newTail;
|
||||
|
||||
// There is some event to process, we need an UI redraw.
|
||||
// UI redraw request is cancelled if we're in standby mode.
|
||||
redraw_needed = true;
|
||||
if(standby) redraw_needed = false;
|
||||
|
||||
// Check if battery has enough charge to operate.
|
||||
// Check is skipped if there is an ongoing transmission, since the voltage
|
||||
// drop caused by the RF PA power absorption causes spurious triggers of
|
||||
|
|
@ -1668,8 +1675,11 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
}
|
||||
}
|
||||
|
||||
void ui_updateGUI()
|
||||
bool ui_updateGUI()
|
||||
{
|
||||
if(redraw_needed == false)
|
||||
return false;
|
||||
|
||||
if(!layout_ready)
|
||||
{
|
||||
layout = _ui_calculateLayout();
|
||||
|
|
@ -1777,11 +1787,16 @@ void ui_updateGUI()
|
|||
_ui_drawLowBatteryScreen();
|
||||
break;
|
||||
}
|
||||
|
||||
// If MACRO menu is active draw it
|
||||
if(macro_menu) {
|
||||
if(macro_menu)
|
||||
{
|
||||
_ui_drawDarkOverlay();
|
||||
_ui_drawMacroMenu(&last_state);
|
||||
}
|
||||
|
||||
redraw_needed = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ui_pushEvent(const uint8_t type, const uint32_t data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue