How to reconnize reason of missing build-in icon


Hi, I’m facing issue with missing build-in icon (any SYMBOL_BATTERY_ ).

Sometimes instead of icon I see “?” symbol (see picture in the end of post).

In what cases “?” used and what does it mean?

I CANT reproduce this on PC simulator, but on MCU this happens in pretty stable maner.

Maybe someone have idea where to pay attention?

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

ESP32 with esp-idf ; LVGL 5.3

What do you want to achieve?

Displaying icons or understand reason why this may happens. Lack of memory? Miss position of some element? :man_shrugging:

What have you tried so far?

I’m testing with different sizes of header, different alignment, different strings.
I noticed that this happens when I use cyryllic strings in header, with english text it always work.

Code to reproduce

Here is code, but again, on simulator this works and dont cause issue…

lv_obj_t * draw_battery_header(uint8_t bat_percent)
	lv_obj_t * label_battery = lv_label_create(lv_scr_act(), NULL);

	switch (bat_percent)
	case 100:
		lv_label_set_text(label_battery, SYMBOL_BATTERY_FULL);
	case 75:
		lv_label_set_text(label_battery, SYMBOL_BATTERY_3);
	case 50:
		lv_label_set_text(label_battery, SYMBOL_BATTERY_2);
	case 25:
		lv_label_set_text(label_battery, SYMBOL_BATTERY_1);
		lv_label_set_text(label_battery, SYMBOL_BATTERY_EMPTY);

	lv_obj_align(label_battery, NULL, LV_ALIGN_IN_TOP_LEFT, 9 , 5);

	return label_battery;

lv_obj_t * scr_set_header(const char* lang_txt, const char* default_txt)
	lv_obj_t * header = NULL;
	lv_obj_t * battery = NULL;

	battery = draw_battery_header(100);

	header = lv_label_create(lv_scr_act(), NULL);

	if (lang_txt != NULL) // specific lang name string exist
		lv_label_set_text(header, lang_txt);
	else // if no name found - load default english text
		lv_label_set_text(header, default_txt);

	lv_obj_align(header, battery, LV_ALIGN_OUT_RIGHT_MID, 2, 0);
	lv_label_set_long_mode(header, LV_LABEL_LONG_ROLL);
	lv_obj_set_size(header, 102, 20);
	lv_label_set_anim_speed(header, 60);
	return header;

static void screen_with_missing_battery()
	static lv_obj_t * scr = NULL;

	scr = lv_obj_create(NULL, NULL);


	scr_set_header(NULL, "Результат"); // with English text alwys work fine

Screenshot and/or video


Here is how looks like on MCU screen

I have a vague memory about I’ve used ? as an initial value at someplace but I can’t find it now.

I suggest creating only the battery label and debug where the value is replaced with ?. Firstly you should start in lv_draw_label() to see how the letters are fetched from the string.

1 Like