I am having trouble with rewriting lv_label with lv_label_set_text_fmt function. When I send there a first String, it always works fine. But anytime I continue with sending there another one, usually longer one, it shows just “X?” or “H?”. I assume it has something to do with the buffer and memory, or so?
NOTE: Please keep in mind that this simplified example could of course work a lot easier and I wouldn’t have to use lv_label_set_text_fmt. However, in my case I have to use this function, it is mainly a principle.
EDIT: I found out that Strings longer than 10 characters make problems…
Thank you for all your effort and time!
/* simplified */ #include <lvgl.h> #include <Arduino.h> // SETUP lv_obj_t *label_product; label_product = lv_label_create(lv_scr_act()); lv_label_set_text(label_product, "text"); lv_obj_align(label_product, LV_ALIGN_TOP_MID, 0, 60); // FUNCTION String product_name = "short"; lv_label_set_text_fmt(label_product, "%s", product_name); // Something is happening product_name = "loooooooong"; lv_label_set_text_fmt(label_product, "%s", product_name);