-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add flag variable and state variable support for [create_screen_...] functions #645
base: master
Are you sure you want to change the base?
Conversation
Your code doesn't work in all cases. It works only if expression for Hidden flag or Disabled state is simple expression where only native variable is used. But expression can be anything, at least if you are using EEZ Flow. Alternative way to prevent flickering is to call |
In my case, I use lvgl in pure C, so I can't use EEZ Flow.I'm really sorry I didn't think about how the EEZ Flow would affect this. I think I need to describe my problem in more detail. With the limited ram, I can't create all screen's in ui_init(). So i edited the
And remove Widgets created in the new screen always flicker briefly in their default state before the state set by the global variable is applied. I'm unsure of the exact cause, but it seems logical to initialize the created state with the value from the global variable. However, this approach doesn't take into account the expression with the EEZ Flow. It turns out that I'm facing a similar problem with widget expression property. I haven't updated all widgets either, and I believe we should address this issue together first. |
Calling ui_tick() after load_screen() should fix my issue. I'd like to do more testing when I return to the lab next Monday. |
The test results were unexpectedly strange and did not meet my expectations. I modified the
Therefore, during However, in the first I've noticed that the background colors of the three switches in the header are incorrect in some cases. The first and last images show the expected |
That's very strange, But the program isn't working the way it should. Maybe i need to continue this PR, could I add |
I don't know why in your case you are seeing unexpected behavior. I made a project that does (I think) similar thing as yours: I didn't notice any strange behavior. State of 2 label objects (I purposefully left the state of the middle label unchanged) are turned into DISABLED within |
In my case,after In the picture2, breakpoint in I had try my project in LVGL Simulator, this problem is not reproducible. This problem might be related to the underlying rendering logic of LVGL, especially in MCUs with limited single-thread resources. My platform is gd32f407vet6,168MHz MCU,64k RAM, with screen drive by st7796 16bits parallel interface, screen resolution 480x320. I think I need to port your test project to my platform for testing, but it might take some time. My schedule is pretty full this week. |
If the variable is only used in the tick function, screen switching may cause state flickering. Initially, the widget state is the default lvgl state, and it won't switch to the variable-specified state until the next tick, resulting in flickering.
Therefore, it's necessary to get the variable value and set the state once during screen creation.
As shown in the image below.