LV_SYMBOL_xx - displayed in half or none displayed

Description

I want to use the symbols LV_SYMBOL_UP, LV_SYMBOL_DOWN, LV_SYMBOL_RIGHT as axes ends.

What MCU/Processor/Board and compiler are you using?

STM32F769NI / STM32F769I-DISCO / Atollic TrueStudio

What do you experience?

Only the symbol LV_SYMBOL_UP is written on the display. In the simulator (Visual Studio 2019) is perfect. I change the font and nothing helped.

Code to reproduce

/* label_arrow_right style */
        static lv_style_t style_label_arrow_right;
        lv_style_copy(&style_label_arrow_right, &lv_style_pretty);
	style_label_arrow_right.text.font = &lv_font_roboto_28;
/*************/
        lv_obj_t* img_arrow_right = lv_img_create(parent, label_arrow_right);
	lv_img_set_src(img_arrow_right, LV_SYMBOL_RIGHT);
	lv_obj_set_pos(img_arrow_right, 717, 327);

	lv_obj_t* label_arrow_up = lv_label_create(parent, label_arrow_right);
	lv_label_set_text(label_arrow_up, LV_SYMBOL_UP"I");
	lv_obj_set_pos(label_arrow_up, 7, 56);

	lv_obj_t* cur_arrow_up = lv_img_create(parent, label_arrow_right);
	lv_img_set_src(cur_arrow_up, LV_SYMBOL_UP);
	lv_obj_set_pos(cur_arrow_up, 446, 87);

	lv_obj_t* cur_arrow_down = lv_label_create(parent, label_arrow_right);
	lv_img_set_src(cur_arrow_down, LV_SYMBOL_DOWN);
	lv_obj_set_pos(cur_arrow_down, 446, 310);

Screenshot and/or video

I marked the errors with a red frame and the correct symbols with a green one.
P8050537a
On the LCD of the STM32F769I-DISCO.


In the simulator

Please help. Greetings

If it works normally in the simulator it usually means it’s an issue with your driver.

I use this project stm32f769_disco_no_os_sw4stm32 by moving it to Atollic TrueStudio. The project with the library 5.3 was displayed on the LCD properly. After going to 6.0, these errors appeared.

Does it work in SW4STM32?

Additionally, is LV_USE_GPU enabled? If so, try disabling it and see if that changes things.

Are you using the latest master branch?

I don’t know. I don’t use SW4STM32.

Yes, it was enable. I disabled and checked. Did not help.

Yes, latest version. (You helped me by removing this problem)

I see something strange here:

    lv_obj_t* img_arrow_right = lv_img_create(parent, label_arrow_right);
	lv_img_set_src(img_arrow_right, LV_SYMBOL_RIGHT);
	lv_obj_set_pos(img_arrow_right, 717, 327);

	lv_obj_t* label_arrow_up = lv_label_create(parent, label_arrow_right);
	lv_label_set_text(label_arrow_up, LV_SYMBOL_UP"I");
	lv_obj_set_pos(label_arrow_up, 7, 56);

You copy label_arrow_right as img and label too. However, the create functions can copy an object only with their type. From the code example, I can’t see what is the type of label_arrow_right but it can’t be img and label too.

        lv_obj_t* label_arrow_right = lv_label_create(parent, NULL);
	lv_label_set_text(label_arrow_right, "t");
	lv_obj_set_pos(label_arrow_right, 718, 352);
	lv_label_set_style(label_arrow_right, LV_LABEL_STYLE_MAIN, &style_label_arrow_right);

I will change the code according to your instructions and let you know.

If it still doesn’t work after fixing the copy issue, try it in SW4STM32.

I made two mistakes.
The first mistake.

kisvegabor he was right. Using the label style for the image caused it to not display properly. I changed the code.

        lv_obj_t* label_arrow_up = lv_label_create(parent, label_arrow_right);
	lv_label_set_text(label_arrow_up, LV_SYMBOL_UP"I");
	lv_obj_set_pos(label_arrow_up, 7, 56);

	lv_obj_t* cur_arrow_up = lv_img_create(parent, NULL);
	lv_img_set_src(cur_arrow_up, LV_SYMBOL_UP);
	lv_obj_set_pos(cur_arrow_up, 446, 87);

However, it did not work well (picture below)
20190807_144301a
The second one.
When specifying the style for LV_PAGE_STYLE_SCRL instead of copying the style, I did it according to the code:

        style_page_scrl.body.padding.top = 0;
	style_page_scrl.body.padding.bottom = 0;
	style_page_scrl.body.padding.left = 0;
	style_page_scrl.body.padding.right = 0;
	style_page_scrl.body.padding.inner = 0;

       create_tab1(tab1);
       lv_page_set_style(tab1, LV_PAGE_STYLE_SCRL, &style_page_scrl);

It seems to me that it’s difficult to define how the Tab element will behave, how it will be set in such a style.
Summarizing:
The first problem: I followed the instructions kisvegabor.
The second problem: I looked at lv_style.c and chose the style that suits me best. I copied to style_page_scrl. I have supplemented the above code with one line: lv_style_copy(&style_page_scrl, &lv_style_transp);
Everything works :smiley:
P8070543a

I still have a lot to learn about this wonderful library :blush:

Glad to hear that you made it work!

I don’t really understand this. Can you explain the issue in more detail? It might be useful for others too.

Sorry, I used too big a mental shortcut.

These are my thoughts and conclusions. If I’m wrong, correct me.

By using the Tabview widget, by adding a tab, a page is created. More precisely as described:

Going to the description of the page we read that:

and

The parent for all objects is the scrollable container. My style_page_scrl was set for the scrollable container.
On the website, you recommend that:

When I created style_page_scrl I did it like this:

        lv_style_t style_page_scrl;
        style_page_scrl.body.padding.top = 0;
	style_page_scrl.body.padding.bottom = 0;
	style_page_scrl.body.padding.left = 0;
	style_page_scrl.body.padding.right = 0;
	style_page_scrl.body.padding.inner = 0;

Without copying one of the styles and modifying it or not are initialize all fields of the newly created style, the set style is incomplete. It was my mistake. All style fields have a value of 0 (zero) (padding it’s set 0). After using const lv_style_t* tt = lv_page_get_style(tab1, LV_PAGE_STYLE_SCRL); in the simulation, we can read:


So when for the declaration

        lv_obj_t* cur_arrow_down = lv_img_create(parent, NULL);
	lv_img_set_src(cur_arrow_down, LV_SYMBOL_DOWN);
	lv_obj_set_pos(cur_arrow_down, 446, 334);

The cur_arrow_down object inherits the style by default. And since the parent style has all fields set to 0, hence these display problems. Objects that display correctly have their own styles other than style_page_scrl. So when I supplemented my code with copying style and changed only the padding values, the style had all fields set, different from 0.

        lv_style_copy(&style_page_scrl, &lv_style_transp);
	style_page_scrl.body.padding.top = 0;
	style_page_scrl.body.padding.bottom = 0;
	style_page_scrl.body.padding.left = 0;
	style_page_scrl.body.padding.right = 0;
	style_page_scrl.body.padding.inner = 0;

P.S. sorry for mistakes. I support a translator.

Crystal clear now, thank you! :slight_smile: