ui.c: Remove infinite loop, now handled by task execution in main.c

This commit is contained in:
Federico Amedeo Izzo 2020-11-15 21:25:42 +01:00
parent 89e822813b
commit 11854aaaa6
1 changed files with 31 additions and 30 deletions

View File

@ -90,6 +90,7 @@ typedef struct layout_t
layout_t layout; layout_t layout;
bool layout_ready = false; bool layout_ready = false;
color_t color_white = {255, 255, 255}; color_t color_white = {255, 255, 255};
bool first_run = true;
layout_t _ui_calculateLayout() layout_t _ui_calculateLayout()
{ {
@ -239,6 +240,9 @@ void ui_main()
{ {
OS_ERR os_err; OS_ERR os_err;
if(first_run)
{
first_run = false;
// Init the graphic stack // Init the graphic stack
gfx_init(); gfx_init();
platform_setBacklightLevel(255); platform_setBacklightLevel(255);
@ -257,10 +261,8 @@ void ui_main()
gfx_clearScreen(); gfx_clearScreen();
gfx_render(); gfx_render();
while(gfx_renderingInProgress()); while(gfx_renderingInProgress());
}
// UI update infinite loop
while(1)
{
state_t state = state_update(); state_t state = state_update();
uint32_t keys = kbd_getKeys(); uint32_t keys = kbd_getKeys();
bool renderNeeded = ui_update(state, keys); bool renderNeeded = ui_update(state, keys);
@ -269,9 +271,8 @@ void ui_main()
gfx_render(); gfx_render();
while(gfx_renderingInProgress()); while(gfx_renderingInProgress());
} }
OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err);
}
} }
bool ui_update(state_t state, uint32_t keys) bool ui_update(state_t state, uint32_t keys)
{ {
if(!layout_ready) if(!layout_ready)