Description
The text on the label is garbled as soon as it is refreshed.
What MCU/Processor/Board and compiler are you using?
Nucleo-F401RE
1.8" SPI LCD TFT 128x160 ST7735
System Workbench for STM32
What do you want to achieve?
I want to know why the text is garbled.
What have you tried so far?
I can drive the screen. Text appears at first smoothly.
Code to reproduce
static lv_style_t style0_bar_1;
static lv_style_t style0_label_1;
static lv_style_t style0_label_2;
void my_task(lv_task_t * task);
void demo_create(void)
{
lv_obj_t *parent = lv_disp_get_scr_act(NULL);
lv_task_t * task = lv_task_create(my_task, 500, LV_TASK_PRIO_MID, 0);
#ifdef LV_USE_BAR
lv_style_copy(&style0_bar_1, &lv_style_pretty);
style0_bar_1.body.grad_color = lv_color_hex(0xaaff00);
style0_bar_1.body.radius = 10;
style0_bar_1.body.border.color = lv_color_hex(0xff0000);
style0_bar_1.body.shadow.width = 2;
bar_1 = lv_bar_create(parent, NULL);
lv_obj_set_pos(bar_1, 15, 34);
lv_obj_set_size(bar_1, 126, 24);
lv_bar_set_value(bar_1, 50, LV_ANIM_ON);
lv_bar_set_style(bar_1, LV_BAR_STYLE_BG, &style0_bar_1);
#endif // LV_USE_BAR
#ifdef LV_USE_LABEL
lv_style_copy(&style0_label_1, &lv_style_transp);
style0_label_1.text.color = lv_color_hex(0x303030);
style0_label_1.text.sel_color = lv_color_hex(0x5596d8);
style0_label_1.text.font = &lv_font_roboto_16;
style0_label_1.text.letter_space = 0;
style0_label_1.text.line_space = 2;
style0_label_1.text.opa = 255;
label_1 = lv_label_create(parent, NULL);
lv_label_set_text(label_1, "Fan:");
lv_obj_set_pos(label_1, 45, 69);
lv_obj_set_size(label_1, 31, 19);
lv_label_set_style(label_1, LV_LABEL_STYLE_MAIN, &style0_label_1);
#endif // LV_USE_LABEL
#ifdef LV_USE_LABEL
lv_style_copy(&style0_label_2, &lv_style_transp);
style0_label_2.text.color = lv_color_hex(0x303030);
style0_label_2.text.sel_color = lv_color_hex(0x5596d8);
style0_label_2.text.font = &lv_font_roboto_16;
style0_label_2.text.letter_space = 0;
style0_label_2.text.line_space = 2;
style0_label_2.text.opa = 255;
label_2 = lv_label_create(parent, NULL);
lv_label_set_text(label_2, "0");
lv_obj_set_pos(label_2, 84, 69);
lv_obj_set_size(label_2, 9, 19);
lv_label_set_style(label_2, LV_LABEL_STYLE_MAIN, &style0_label_2);
#endif // LV_USE_LABEL
}
void my_task(lv_task_t * task)
{
lv_label_set_text(label_2, "20");
}