How to call flush_cb periodically

Hi All

lv_disp_drv_t.flush_cb() just calls when display has an update.
But how to flush_cb does periodically even without having display update ?
For example, each 100ms, flush_cb will be called.

Thanks!

static void call_refresh_cb(lv_timer_t *timer)
{
    lv_obj_invalidate(lv_scr_act());
    lv_refr_now(NULL);
}

lv_timer_create(call_refresh_cb, 100, NULL);
1 Like

Hi @spider_vc

Is there any conflict when doing “call_refresh_cb by timer” and “new display update call”.
or do first done first, come later must wait ?

Hi @kisvegabor , @embeddedt

Maybe @spider_vc is busy now, could you answer this question?

★How to set flush_cb to control its execution.

In my app, I want to execute flush_cb each 30ms.
during this time, no matter how much the updated object is, the flush_cb will not be executed.
Right at the time of 30ms, all of them will be included in one flush_cb.

Thanks for your support!

I think you need this feature:
https://docs.lvgl.io/master/porting/display.html#decoupling-the-display-refresh-timer

Hi @kisvegabor

Thanks your reply soon.
As description in your link, xxx_timer is using.
It is xxx_task in LVGL version 7.10.1, isn’t it?

This feature is new working only from v8 :frowning:

Is it possible for you to update to v8?

Hi @kisvegabor

Is there any other solution in v7?
I’m using Gui Guider, and it’s not support v8. :frowning:

Its latest version already supports v8.

Hi @kisvegabor

Its latest version already supports v8.
Thanks for your information. I will check that.

By the way, I edited something as below code, could you help me see if there is any risk?
lv_refr.c
in _lv_inv_area(), I comment out refr task priority setting to prevent refresh screen when update any object.

void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
{
 ・・・
 disp->inv_p++;
 //★lv_task_set_prio(disp->refr_task, LV_REFR_TASK_PRIO);
}

In my application

static void gui_update(lv_task_t * task)
{
 s_disp_lcd = lv_disp_get_default();
 lv_task_set_prio(s_disp_lcd->refr_task, LV_REFR_TASK_PRIO);
}

It will still update the screen in lv_task_handler.

You should call s_disp_lcd->refr_task() directly but you also need to add minor tweaks in refr_task because it waits for an lv_task_t * as it’s parameter.

Thanks for your support!