I’m using a TextArea to show some logs as the user is interacting with the UI. Most of the time it works fine, if I need to show some new message I call lv_textarea_add_text and the message is appended to the end of the textarea.
However, sometimes it does not get updated right away, even though other lvgl elements are. When this happens, if click the text box, it does get updated and displays the text (there are no callbacks associated with removing focus from other objects or selecting the texarea.
From the LVGL, if I updated a textarea using lv_textarea_add_text, is there any other function that I should call to ensure that the widget is updated?
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
What do you want to achieve?
TextArea as log display
What have you tried so far?
This might be a bug. As a workaround, you can use
lv_obj_invalidate(textarea) to force it to redraw after the text is appended.
I also just noticed that it is not only this particular textarea that is not begin updated. I have another label that is only updated one time if a sensor it not present, but if I slide the lvgl screen a bit it gets updated.
Is there a way to debug if lvlg is missing an event? I do have some other tasks running alongside the lvgl task
If you are in a multithreaded environment, ensure you are using a mutex around any LVGL function calls, otherwise weird and inexplicable behavior is likely to occur.
You could also double-check your display driver - perhaps there is an edge case with certain partial refreshes.
I’ll double check and get back to you. I’m using the drivers from the NXP SDK with minimal modification, so I’m assuming that they work.
I’ll also review the concurrent calls and check if everything is properly protected!
Oh, okay. In that case I would agree that the problem is likely somewhere else.
Spot on @embeddedt! I was missing a mutex when updating the textarea from the context of the second thread!