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;
bool layout_ready = false;
color_t color_white = {255, 255, 255};
bool first_run = true;
layout_t _ui_calculateLayout()
{
@ -239,39 +240,39 @@ void ui_main()
{
OS_ERR os_err;
// Init the graphic stack
gfx_init();
platform_setBacklightLevel(255);
// Print splash screen
point_t splash_origin = {0, SCREEN_HEIGHT / 2};
color_t color_yellow_fab413 = {250, 180, 19};
char *splash_buf = "OpenRTX";
gfx_clearScreen();
gfx_print(splash_origin, splash_buf, FONT_SIZE_4, TEXT_ALIGN_CENTER, color_yellow_fab413);
gfx_render();
while(gfx_renderingInProgress());
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
// Clear screen
gfx_clearScreen();
gfx_render();
while(gfx_renderingInProgress());
// UI update infinite loop
while(1)
if(first_run)
{
state_t state = state_update();
uint32_t keys = kbd_getKeys();
bool renderNeeded = ui_update(state, keys);
if(renderNeeded)
{
gfx_render();
while(gfx_renderingInProgress());
}
OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err);
first_run = false;
// Init the graphic stack
gfx_init();
platform_setBacklightLevel(255);
// Print splash screen
point_t splash_origin = {0, SCREEN_HEIGHT / 2};
color_t color_yellow_fab413 = {250, 180, 19};
char *splash_buf = "OpenRTX";
gfx_clearScreen();
gfx_print(splash_origin, splash_buf, FONT_SIZE_4, TEXT_ALIGN_CENTER, color_yellow_fab413);
gfx_render();
while(gfx_renderingInProgress());
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
// Clear screen
gfx_clearScreen();
gfx_render();
while(gfx_renderingInProgress());
}
state_t state = state_update();
uint32_t keys = kbd_getKeys();
bool renderNeeded = ui_update(state, keys);
if(renderNeeded)
{
gfx_render();
while(gfx_renderingInProgress());
}
}
bool ui_update(state_t state, uint32_t keys)
{
if(!layout_ready)