I am dynamically changing the text on a label, however the string being displayed is not consitent.
lv_label_set_text(ui_lblPulse, _string);
Sometimes it adds an extra character at the end (i.e. @ ), and some other times the string is perfectly fine.
Is this a bug, or is there a specific set of steps to successfully update the text on a label.
Thanks
I noticed a pattern than when updating the label’s text from a short string to a longer string, the update works. However when going from long string to a shorter string, the string gets updated with extra characters at the end.
So the solution would be to update frist with couple spaces, before updating to the desired string
lv_label_set_text(ui_lblPulse, " ");
lv_label_set_text(ui_lblPulse, _string);
A string is NULL terminated. there is no length being passed so the only way LVGL is able to determine the length is by a null being at the end of the string. I also believe the string needs to be constant as well.
const char _string[] = "NULL Terminated String\0";
lv_label_set_text(ui_lblPulse, _string);
1 Like
what is string
variable and how did you fill it if it’s array ? kdschlosser
rightly wrote that lv_label_set_text
sets null-teminated strings.
1 Like
I need to see an example of your use case in order to know what to do.