Unfortunately it is a problem because the software is very long
In practice I manage three pages, the passage from one page to another takes place with “” lv_obj_set_hidden (page1, state); “”
through a thread.
The software works well but sometimes crashes or the images are not loaded well on the display. The same thing happens both with the simulator and on the hardware.
I believe that the problem is generated above all when I go to delete a particular page, because being rich in objects it takes up a lot of memory, so I delete it to free up space, with the command:
lv_obj_del (menu_setup_page);
The crash happens every now and then, but especially when I delete a particular page. It would seem a problem of time in a particular moment of change of page status.
The idea is that lv_task_handler can’t be running while another thread is changing internal LittlevGL structures. Something will usually go wrong. For that reason, you should guard calls to lv_task_handler and other LittlevGL APIs with a mutex.
The while loop should lock a mutex, call lv_task_handler, and then unlock that mutex.
Other threads should lock the same mutex, call whatever LittlevGL APIs they wish to use, and unlock the mutex. There shouldn’t be any concern about the thread blocking for an extended period of time because all LittlevGL APIs are non-blocking.
That’s a key point.Don’t realize this before.
My code also crash sometimes where another thread called the lvgl api.First I thoght the ram give to it maybe too small,it should be this.