I’m using LVGL 8.3 in a Linux embedded device. The LVGL port for this device was done by the manufacturer and we just get a library and link to it.
I’m having the following problem: this is a large application (~1MB binary) and there are lots of “screens” I have to handle (the code was already written when I came and I’m just updating it). By screen, I mean the same thing as an old Delphi or VB6 form. Well, I added some new screens and when I just enter these new screens the application crashes. It does not crash when I enter the other screens (the ones that were already there)
- I have only one display which is properly setup and run;
Custom LLVM-based toolchain. The manufacturer provides the toolchain.
I need to be able to load/unload screens without crashing the application.
Here is what I think it would be a better approach: every time I need to show a new form, I will have a static C variable which will hold the screen object. In the first time I call the form show function I will create all widgets, GUI objects and setup event handlers. In the subsequent calls, I will just call `lv_scr_load with my screen object and that’s it. Is this a good approach?
The way they are implemented in this application is the following: everything is a child of the
mainScreen, including the
displayScreen which is cleaned, and objects are added to it everytime I have to show a different form. I’m not sure why this is done the way it is.
displayScreen is deleted and recreated everytime I need to show a new form.
So the question is: what is the proper way to handle screens?