Description
When I tested some objects, I found that some of the objects could not be displayed normally, and a lot of stripes appeared on the screen. I am not sure what the reason is, because some controls are not problematic.
What MCU/Processor/Board and compiler are you using?
STM32F746
What do you experience?
For example, when I tested lv_calendar, there was no problem at all. All the displays were normal and the touch could be controlled normally, but when I tested lv_sw, many stripes appeared on the right half of the screen.
What do you expect?
No stripes appear on the screen, and all objects can be displayed normally.
Code to reproduce
Add a code snippet to reproduce the issue in the simulator. It should contain only the relevant code which can be compiled. Bug reports without code snippets or with erroneous code snippets will not be reviewed.
lv_calendar
static void calender_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
lv_calendar_date_t * date = lv_calendar_get_pressed_date(obj);
if(date) {
lv_calendar_set_today_date(obj, date);
}
}
}
static void calendar_test(void)
{
lv_obj_t * calendar = lv_calendar_create(lv_scr_act(), NULL);
lv_obj_set_size(calendar, 460, 460);
lv_obj_align(calendar, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(calendar, calender_event_handler);
/*Set the today*/
lv_calendar_date_t today;
today.year = 2020;
today.month = 3;
today.day = 18;
lv_calendar_set_today_date(calendar, &today);
lv_calendar_set_showed_date(calendar, &today);
/*Highlight some days*/
static lv_calendar_date_t highlihted_days[1]; /*Only it's pointer will be saved so should be static*/
highlihted_days[0].year = 2020;
highlihted_days[0].month = 3;
highlihted_days[0].day = 28;
lv_calendar_set_highlighted_dates(calendar, highlihted_days, 1);
}
lv_sw
static void sw_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
printf("State: %s\n", lv_sw_get_state(obj) ? "On" : "Off");
}
}
static void sw_test(void)
{
/*Create styles for the switch*/
static lv_style_t bg_style;
static lv_style_t indic_style;
static lv_style_t knob_on_style;
static lv_style_t knob_off_style;
lv_style_copy(&bg_style, &lv_style_pretty);
bg_style.body.radius = LV_RADIUS_CIRCLE;
bg_style.body.padding.top = 6;
bg_style.body.padding.bottom = 6;
lv_style_copy(&indic_style, &lv_style_pretty_color);
indic_style.body.radius = LV_RADIUS_CIRCLE;
indic_style.body.main_color = LV_COLOR_BLUE;
indic_style.body.grad_color = LV_COLOR_NAVY;
indic_style.body.padding.left = 0;
indic_style.body.padding.right = 0;
indic_style.body.padding.top = 0;
indic_style.body.padding.bottom = 0;
lv_style_copy(&knob_off_style, &lv_style_pretty);
knob_off_style.body.radius = LV_RADIUS_CIRCLE;
knob_off_style.body.shadow.width = 4;
knob_off_style.body.shadow.type = LV_SHADOW_BOTTOM;
lv_style_copy(&knob_on_style, &lv_style_pretty_color);
knob_on_style.body.radius = LV_RADIUS_CIRCLE;
knob_on_style.body.shadow.width = 4;
knob_on_style.body.shadow.type = LV_SHADOW_BOTTOM;
/*Create a switch and apply the styles*/
lv_obj_t *sw1 = lv_sw_create(lv_scr_act(), NULL);
lv_sw_set_style(sw1, LV_SW_STYLE_BG, &bg_style);
lv_sw_set_style(sw1, LV_SW_STYLE_INDIC, &indic_style);
lv_sw_set_style(sw1, LV_SW_STYLE_KNOB_ON, &knob_on_style);
lv_sw_set_style(sw1, LV_SW_STYLE_KNOB_OFF, &knob_off_style);
lv_obj_align(sw1, NULL, LV_ALIGN_CENTER, -400, -50);
lv_obj_set_event_cb(sw1, sw_event_handler);
/*Copy the first switch and turn it ON*/
lv_obj_t *sw2 = lv_sw_create(lv_scr_act(), sw1);
lv_sw_on(sw2, LV_ANIM_ON);
lv_obj_align(sw2, NULL, LV_ALIGN_CENTER, -400, 50);
}
The code is based on the routine, there should be no problem, I think there should be no problem with the display driver, because not all objects are displayed abnormally.
This project can be found at my Github