Description
void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
uint16_t type max is 65 seconds, for example I make a music process bar, time is not enough.How to solve this problem?
What MCU/Processor/Board and compiler are you using?
esp32
Code to reproduce
#include "lvgl/lvgl.h"
void lv_ex_bar_1(void)
{
lv_obj_t * bar1 = lv_bar_create(lv_scr_act(), NULL);
lv_obj_set_size(bar1, 200, 30);
lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0);
lv_bar_set_anim_time(bar1, 65536);
lv_bar_set_value(bar1, 100, LV_ANIM_ON);
}
I think (but I haven’t tested it) you would have to split the animation into pieces (each 65 seconds long) and run it multiple times. That should give the same visual effect.
1 Like
uint16_t range is 0 to 65535.
You are overflowing the variable with 65536.
65536 = 1 0000 0000 0000 0000
Set a second long timer to handle the updates or do it as you decode the music stream.
How to do this? Would you like to show a code please?
Hey, I just tried the bar object, it seems that “lv_bar_set_anim_time” function didn’t work even for 65s as you said, I guess this anim_time is not for bar driving but just a refresh time, the “value” in “lv_bar_set_value” fun maybe what you want, so i tried this: create a timer for counting time, and every second calls the"lv_bar_set_value" fun, and changing the value.
Like this,hope helpful.
I guess see you in
whycan.cn
My mistake, in fun “dynamic_drive_bar”, it’s “<=” not “!=” in “if()”