Important: posts that do not use this template will be ignored or closed.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Be sure you have checked the relevant part of the documentation. We will not respond in detail to posts where you haven’t read the relevant documentation.
- If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
Based on Lvgl 6.0, I created a group and added four image objx. After initialization, everything works fine, but when the encoder is rotated, the previously pointed object is not refreshed.
After normal initialization. It is shown as follows:
After rotating the encoder, it is shown as follows:
What MCU/Processor/Board and compiler are you using?
STM32F303xx
What do you want to achieve?
Why the previously pointed object is not refreshed? and how to fix it?
What have you tried so far?
I tried to create four simple buttons and everything worked fine.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
void main_desk(void)
{
/*use night theme */
// lv_theme_set_current(lv_theme_night_init(MYHUE,NULL));
main_group=lv_group_create();
/*Add encode to control the list */
lv_indev_drv_t enc_drv;
lv_indev_drv_init(&enc_drv);
enc_drv.type = LV_INDEV_TYPE_ENCODER;
enc_drv.read_cb = encode_read;
lv_indev_t * enc_indev = lv_indev_drv_register(&enc_drv);
lv_indev_set_group(enc_indev, main_group);
/*create a win */
static lv_style_t win_style;
lv_style_copy(&win_style, &lv_style_pretty);
// win_style.body.main_color=LV_COLOR_BLACK;
win_style.image.color=LV_COLOR_GREEN;
win_style.body.padding.left= 50;
win_style.body.padding.right = 50;
win_style.body.padding.inner = 35;
mian_win = lv_win_create(lv_disp_get_scr_act(NULL), NULL);
lv_win_set_layout(mian_win,LV_LAYOUT_GRID);
lv_win_set_style(mian_win, LV_WIN_STYLE_CONTENT, &win_style);
// lv_obj_set_size(mian_win, LV_HOR_RES_MAX, LV_VER_RES_MAX);
lv_win_set_title(mian_win,"");
lv_win_add_btn(mian_win,LV_SYMBOL_POWER);
lv_win_add_btn(mian_win,LV_SYMBOL_BATTERY_FULL);
LV_IMG_DECLARE(Wave);
LV_IMG_DECLARE(Battery);
LV_IMG_DECLARE(Power);
LV_IMG_DECLARE(Settings);
lv_obj_t * Power_img = lv_img_create(mian_win, NULL);
lv_img_set_src(Power_img,&Power);
// lv_obj_set_pos(Power_img,65,25);
lv_group_add_obj(main_group,Power_img);
lv_obj_set_event_cb(Power_img,list_btn_event_handler);
lv_obj_t * Wave_img = lv_img_create(mian_win, NULL);
lv_img_set_src(Wave_img,&Wave);
// lv_obj_set_pos(Wave_img,198,25);
lv_group_add_obj(main_group,Wave_img);
lv_obj_set_event_cb(Wave_img,list_btn_event_handler);
lv_obj_t * Battery_img = lv_img_create(mian_win, NULL);
lv_img_set_src(Battery_img,&Battery);
// lv_obj_set_pos(Battery_img,65,122);
lv_group_add_obj(main_group,Battery_img);
lv_obj_set_event_cb(Battery_img,list_btn_event_handler);
lv_obj_t * Settings_img = lv_img_create(mian_win, NULL);
lv_img_set_src(Settings_img,&Settings);
// lv_obj_set_pos(Settings_img,198,122);
lv_group_add_obj(main_group,Settings_img);
lv_obj_set_event_cb(Settings_img,list_btn_event_handler);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.