Description
Because of nrf spi speed limitation for LCD , when try to create object, e.g: LV_LIST, and add some different state styles, and scroll up/down, the button items move very slow, and it seems every states/styles trans of a widget has anim effect by default, So need to know how and where to remove all style transition/anim effects of widget, and it’s better it can be done when object/widget created
What MCU/Processor/Board and compiler are you using?
nrf52840 with segger embedded studio
What LVGL version are you using?
8,3
What do you want to achieve?
A way to disable “all” style/event animi/transition of widgets when object created , because I dont know how to, how many and where to do so, hope performance will be same as lvgl7.
What have you tried so far?
1.Refer to How to disable the scroll animations of TableView - #4 by lagadmar, set anim time to 0, but still slow, maybe need to find out more event has anim effect.
2.Try to step debugging to see which style,callback anim/transition effect will be called. eg: background, then try to add zero timing transition for some style of state, no obvious improve
- Where to disable: modify following related settings,result is better
lv_object_scroll.c,
#define SCROLL_ANIM_TIME_MIN 0//200 /ms/
#define SCROLL_ANIM_TIME_MAX 0//400 /ms/
disable LV_USE_ANIMIMG
LV_THEME_DEFAULT_TRANSITION_TIME = 0
Code to reproduce
static void btn_event_handlers(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
lv_anim_t * a = (lv_anim_t *) lv_event_get_param(e);
switch(code){
case LV_EVENT_PRESSED:
if (a) a->time = 0;
break;
case LV_EVENT_CLICKED:
if (a) a->time = 0;
break;
case LV_EVENT_LONG_PRESSED:
if (a) a->time = 0;
break;
case LV_EVENT_LONG_PRESSED_REPEAT:
if (a) a->time = 0;
break;
case LV_EVENT_KEY:
if (a) a->time = 0;
break;
case LV_EVENT_FOCUSED:
if (a) a->time = 0;
break;
default:
break;
}
main()
…
lv_style_reset(&style_watchface_list_btn);
lv_style_reset(&style_watchface_list_btn_pressed);
lv_style_reset(&style_watchface_list_btn_focused);
…
lv_style_set_bg_color(&style_watchface_list_btn, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_bg_color(&style_watchface_list_btn_pressed, lv_color_make(0x00, 0x00, 0xFF));
lv_style_set_bg_color(&style_watchface_list_btn_focused, lv_color_make(0x00, 0x00, 0x00));
…
static const lv_style_prop_t props[] = {LV_STYLE_PROP_ANY, 0};
static lv_style_transition_dsc_t trans_pr;
lv_style_transition_dsc_init(&trans_pr, props, lv_anim_path_linear, 0, 0, NULL);
lv_style_set_transition(&style_watchface_list_btn, &trans_pr);
lv_style_set_transition(&style_watchface_list_btn_pressed, &trans_pr);
lv_style_set_transition(&style_watchface_list_btn_focused, &trans_pr);
…
lv_style_set_anim_time(&style_watchface_list_btn,0);
lv_style_set_anim_time(&style_watchface_list_btn_pressed,0);
lv_style_set_anim_time(&style_watchface_list_btn_focused,0);
…
watchface_list = lv_list_create(page);
for (int i = 0; i < 7; i++) {
uint8_t x = 0;
list_btns[i] = lv_btn_create(watchface_list);
lv_obj_set_size(list_btns[i], 360, 80);
lv_obj_add_style(list_btns[i], &style_watchface_list_btn,LV_STATE_DEFAULT);
lv_obj_add_style(list_btns[i], &style_watchface_list_btn_focused,LV_STATE_FOCUSED);
lv_obj_add_style(list_btns[i], &style_watchface_list_btn_pressed,LV_STATE_PRESSED);
lv_obj_add_event_cb(list_btns[i], btn_event_handlers, LV_EVENT_ALL , NULL);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.