-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp_lvgl_port: change init config to use pdTICKS_TO_MS (BSP-275) #134
Conversation
|
Hello @kutu , Would that help your problem? |
i currently do like this: lvgl_port_cfg_t lvgl_cfg = ESP_LVGL_PORT_INIT_CONFIG();
lvgl_cfg.task_max_sleep_ms = pdTICKS_TO_MS(5);
lvgl_cfg.timer_period_ms = pdTICKS_TO_MS(1); i think default config should work without issues out of the box, people who will stumble upon same issue, will have to dig into to understand that they need to change that 500ms as i said in my pr, everything works fine if you use FPS meter, but then you remove it and your display needs to update something only every 1s (not often) then problem starts |
Hello @kutu, And about using the macro |
i choose currently if i choose i noticed issue in simple clock, when you have colon symbol flashing every 1sec, and nothing else is happening on the screen if you try to make such example, you might notice that colon is flashing relatively every 1s, but every 10secs or so, you will notice it flashes with 500ms delay, and then all repeats. while investigating my "colon flashing" issue, i looked into others implementation of lvgl port, and found this while (1) {
/* Delay 1 tick (assumes FreeRTOS tick is 10ms */
vTaskDelay(pdMS_TO_TICKS(10)); and https://github.com/lvgl/lv_port_esp32/blob/master/main/main.c#L213 lv_tick_inc(LV_TICK_PERIOD_MS); which is 1ms so, after changing default value of but i also understand that config all i wanted is to resolve issue that i have to other people, who might not dig that far to find out why their colon is blinking not consistently you can close this issue if this 500ms is intended and suit to most users |
For time sensitive applications, you can use esp_timer which has microsecond resolutions and very low latency.
The whole concept of power saving and related LVGL task timing will be revisited after LVGL v9 is released, thanks! |
Disclamer: I'm newbie in C and lvgl
with 100hz tick rate setting
timer_period_ms = currently 5ms is 0 ticks
and task_max_sleep_ms 500ms is too much
I created rtos task where I show/hide colon symbol every 1sec (I'm using
xTaskDelayUntil(&last_wakeup, pdMS_TO_TICKS(1000));
)I spend quite some time figuring out why my clock colon symbol was not rendering at rate of 1sec
with timer_period_ms=500ms setting, colon symbol was flashing every 1050ms, and when time debt of 50ms overlap 500ms, it was rendering again
so basically delay was:
1050 - colon appear
1050 - colon disappear
1050 - appear
450 - disappear
1050 - appear
1050 - disappear
I looked at other lvgl ports, and found that
lv_tick_inc()
should be invoked as short as possible, usually every 1msand
lv_timer_handler()
should be every 5mswith proposed settings, tick will be 10ms and timer handler will be 50ms
my colon is now rendering consistently around every 1sec
The problem lays down in
_lv_disp_refr_timer()
functionIf you configure lvgl settings to show fps counter or memory monitor, then timer is not paused, and you will end up with refresh rate that you set in settings - so no visible problems here
But if you don't use those, timer gets paused, and function
lv_timer_handler()
inlvgl_port_task()
returns 0xfffffffftask_delay_ms
until next refresh, which is shortened bytask_max_sleep_ms
to 500msmaybe better approach would be to put this numbers into KConfig