Label update doesn't work in V8.0.0

thanks to kindly comment, I success migration from v7.6.1 to v8.0.0.

now, I try to run lvgl sample app based on v8.0.0.

unfortunately, count_label isn’t updated and show as “Text”

it seems like “lv_label_set_text_fmt” didn’t work in while statement.

void main(void)
{
uint32_t count = 0U;
char count_str[11] = {0};
const struct device *display_dev;
lv_obj_t *hello_world_label;
lv_obj_t *count_label;

display_dev = device_get_binding(CONFIG_LVGL_DISPLAY_DEV_NAME);

if (display_dev == NULL) {
    LOG_ERR("device not found.  Aborting test.");
    return;
}

if (IS_ENABLED(CONFIG_LVGL_POINTER_KSCAN)) {
    lv_obj_t *hello_world_button;

    hello_world_button = lv_btn_create(lv_scr_act());
    lv_obj_align(hello_world_button, LV_ALIGN_CENTER, 0, 0);
    hello_world_label = lv_label_create(hello_world_button);
} else {
    hello_world_label = lv_label_create(lv_scr_act());
}

lv_label_set_text(hello_world_label, "Hello world!");
lv_obj_align(hello_world_label, LV_ALIGN_CENTER, 0, 0);

count_label = lv_label_create(lv_scr_act());
lv_obj_align(count_label, LV_ALIGN_BOTTOM_MID, 0, 0);

// lv_task_handler();
display_blanking_off(display_dev);

while (1) {
    lv_label_set_text_fmt(count_label, "%d", count);
    lv_task_handler();
    k_sleep(K_MSEC(1000));
    ++count;
}

}

after changing like below; count_label is updated now.

  •    while (1) {
             lv_label_set_text_fmt(count_label, "%d", count);
             lv_refr_now(NULL);           <<<<<<<<<<<<< add
              lv_task_handler();
              k_sleep(K_MSEC(1000));
              ++count;
      }
    

as far as I know, “lv_refr_now()” ans “lv_task_handler()” is quite similar. both thing are calling “_lv_disp_refr_timer” to call "flush_cb() " in lvgl v8.0.0.

what is difference between lv_refr_now() and lv_task_handler()?

Thanks

They are really the same.

It works for me in the simulator:

 lv_obj_t * label = lv_label_create(lv_scr_act());

  while (1) {
      lv_label_set_text_fmt(label, "%d", count);
      lv_task_handler();
      usleep(1000 * 1000);
      ++count;
  }

Please enble logging to see what happens.

Maybe there is a crash in an lv_task.

Have you changed your driver like this?

Hi kisvegabor

Thanks for your kindly comment.
when I checked in detail, as you comment, there is no problem in sample application.
the problem is lv_tick_get() doesn’t work caused by that I didn’t set system click(?) properly

more detail…

when I checked the difference the lv_refr_now() and lv_timer_create in v8.0.0. (cf. lv_task_create in v.7.6.1), there is a little bit difference regarding period.

lv_refr_now() is calling “_lv_disp_refr_timer()” immediately.
but, lv_timer_create() is calling “lv_timer_exec()” and there is some condition which checking the time_remaining in lv_timer_exec(). so if time remaining is 0, “_lv_disp_refr_timer()” is called.

as you know, when we call “lv_timer_create()”, we have to set the period (30 as default.
however, I didn’t set custom tick so lv_tick_get() always return 0.
so, this value never greater than default period(30) that’s why our display doesn’t update .

so I changed custom tick like below;

  • lv_conf.h
    #define LV_TICK_CUSTOM 1
    #if LV_TICK_CUSTOM
    #define LV_TICK_CUSTOM_INCLUDE “kernel.h”
    #define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32())
    #endif

that’s why this applpication is working well on your simulator.

Thanks
Best Regards

1 Like

A few weeks ago I added a feature to log a warning if LVGL’s tick is not incremented.
Have you seen that warning?

From your guide, I enable log. But lvgl log is not printed.
I think there is some problem in printing log.
So I can’t see that log.
Let me check log service firstly.
And could you let me know which log should be printed when lvgl thick isn’t working

Thanks
Best Regards

Thanks for your contributing!
My lv_timer doesn’t work for 2days, and I modify the LV_TICK_CUSTOM, it’s OK!!!