Hi @real23355 ,
Your while()
loop in main has too longer sleep time to give you a workable solution. Depending on your system performance I would call lv_task_handler() somewhere between every 10 and 50mS. You either need to create a static counter in main to trigger the mode change or create an lv_task
as I have described here, this link explains how to structure your code to deal with events with out blocking the system processing, which also applies to your scenario.
A quick solution using a static counter would be something like this:
int mode_test=0;
int main(int argc, char** argv)
{
static uint32_t timer;
lv_init();
hal_init();
test();
while (1) {
if( timer++ > 100 ) { // Do this every 5 seconds
mode_test++;
if (mode_test > 3)mode_test = 1;
change_mode(mode_test);
timer = 0;
}
lv_task_handler(); // Always call lv_task_handler() every ~50mS to keep GUI responsive
usleep(50000);
}
}
I hope that is helpful.
Kind Regards,
Pete