Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant Code Generation for every widget state. #24

Open
SirDeadlystrike opened this issue May 26, 2022 · 3 comments
Open

Redundant Code Generation for every widget state. #24

SirDeadlystrike opened this issue May 26, 2022 · 3 comments

Comments

@SirDeadlystrike
Copy link

SirDeadlystrike commented May 26, 2022

I have found that when generating code, a lot settings are duplicated resulting in unneeded bloat and wasted flash/memory space.

LVGL widgets will always use the styles/settings for the DEFAULT state unless that specific property is overridden for the current state.

This builder seems to always explicitly generate definitions for every possible state no matter if it was modified or not.

For example: If you add a simple button widget, and give it a text string, and change is border color. The generated code will include unique definitions for every single possible Button State, most of which are redundant.

On a simple page with 10 Widgets and minor styling, the resultant code is around 183 lines. After going through the code manually, and deleting redundant declarations, it can be simplified to less then 70 lines.

Awesome Tool BTW!

@mrQzs
Copy link
Collaborator

mrQzs commented Jun 29, 2022

Yes, I also realized this problem. I found that the official value comparison function will not work. So store the value of some commonly used component styles to a file, read it when the program starts, and then export the code again. To compare values, this will filter out a lot of invalid codes.

@d985201002
Copy link

@mrQzs
I found the way LVGLBuilder gets widget's properties for different states maybe is incorrect , that's why comparison function not work.

@mrQzs
Copy link
Collaborator

mrQzs commented Sep 24, 2022

@d985201002 Thank you for finding the problem, you can submit the code~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants