How to change screen without click event

Hi All,

I have a problem as below topic, but just a different point in my case.

above topic is that screen will be changed by click event.
In my case, screen cant not touch, and screen will be changed when receive trigger from other task such as message as below image
image

My code is below:

event_screen_hanlder( message *msg )
{
if( 2 == msg.lp )
{
lv_obj_clean(lv_scr_act());
setup_screen_2();
lv_scr_load( screen_2 );
}
}

I debug and saw that _lv_area_is_in returned false at below

if(ain_p->x1 >= aholder_p->x1 && ain_p->y1 >= aholder_p->y1 && ain_p->x2 <= aholder_p->x2 &&
ain_p->y2 <= aholder_p->y2) {
is_in = true; // can not reach here
}

if(radius == 0) return is_in;

I also tested screen change with timer in main, but the same of problem.
How can I change screen manually( timer, message from other task) without click/press event

There is no support from team, waiting… :frowning:

@kisvegabor , @embeddedt
Could you support me this issue?

Sorry but form your description I don’t understand what the issue is.
What happens after lv_scr_load( screen_2 );? Crash? Nothing? Anything else?

If you use and OS be sure to check this part of the docs.

→ Nothing happens
â–  Without touch screen
If I call directly lv_scr_load() or object setting such as lv_label_set_text() , there is nothing happens.
I attached my code. you can refer to littlevgl_guider.c, AppTask() { call_screen_2() }
( just screen_1 is displayed, screen_2 can not displayed )

I also used lv_event_send() to generate CLICKED event, then call lv_scr_load() , but the same phenomenon ( nothing happens )
( This app is using FreeRTOS, but only one task use LVGL.)

â–  Support touch screen
Via touch, CLICKED event is generated, then call directly lv_scr_load() is OK.

I wonder,
is it that if lv_tick_inc(1) is not called, lv_scr_load() or lv_label_set_text() will have no effect even if lv_task_handler() is called in main loop ??

If LVGL is not being ticked, the screen will never be redrawn, as it relies on ticks to know when to render the next frame.

1 Like

Thanks for your information.

I am having a similar issue , one of my screen will render on a button click event and based on an enum (state value) change it will render another screen . I am using lvgl version 8.2 and couldn’t find a solution for it.

Is lv_tick_inc() called continuously?

Nope , Do I have to call lv_tick_inc() prior to each and every lv_scr_load() …Then I will do it …
Other than that, is there any way to automatically move onto or render another screen after a certain time, like a time out event . It looks like we can do it with later versions but that’s not the case with version 8.2 .It seems like tasks stripped of some of its features.

Also it will be really helpful if you include a minimal sample code on how to include lv_tick_inc().

lv_tick_inc() will notify to lvgl lib the system time which use for lv_task (lv_timer in v8), lv_anim,…
I think changing screens is also a lv_task.

refer to Tick interface — LVGL documentation for detail.

Example for FreeRTOS, If your system is Non-OS, place lv_tick_inc() in timer function.

int main(void)
{
    /* your code */

    for (;;)
    {
        lv_task_handler();
        vTaskDelay(5);

        if( true == xyz )
        {
              lv_scr_load(next_screen);
        }
    }
}

void vApplicationTickHook(void)
{
   lv_tick_inc(1);
}
1 Like

Thanks a lot.