Hi @amirgon that was useful info, thank you!
However in my case the sleep function was there just to exaggerate what is happening and debugging. If I delete it my problem happens anyway. In my normal program I don’t have a sleep function.
Also sleep doesn’t prevent what is before from running if I make something simple like
it will print everything before sleep.
Anyway that is not the real problem (although I am thankful for the explanation!)
Let me try to explain better
- In main menu I can choose different options I have a list with callbacks.
- I choose for example the login option. The callback calls a Login function.
2a. In the login function I have a different screen that asks the employee to swipe the card.
2b. the employee swipes the card and a screen with auth successful appears.
- Goes back to main menu screen (with authenticated options).
This would be normal the behavior… what happens is:
- Choose login
- Stays on main menu screen but I know for a fact that the authentication algorithm is running and waiting for me to swipe my card, if I swipe my card the main menu changes to step 3. steps 2a and 2b are “jumped”.
I have the exact same Login function running when the device starts and at that time everything goes smoothly… What I found out was:
Inside a button callback (from a list for example) , I can’t refresh any screen… The screen only refreshes when it exits the function callback (and it renders the last screen that was loaded inside the callback ) BUT JUST AFTER IT EXITS THE CALLBACK.
I also tried to use this function several times in a row from outside the callback and all goes smoothly, it goes through all the steps and works fine… Is just when I am using it in a callback…
Once again, Thank you!
TL:DR Inside a event callback from a list if you call a function that renders different screen objects etc it won’t render the screen until the callback is finished , even though all the function code is ran included lv.scr_load(screen) etc. After exiting the callback, the last screen state from inside the callback will be rendered… This is a major upset… any way to fix this or work around it? I want to be able to change my screen while inside the function that is called in the callback.