I am working on a power button that hides the buttons and and labels and shows a “Powering down” label then calls the power down function.
What have you tried so far?
When not calling the function, it works as expected, Hides Everything and then shows the label showing “Powering Down”. When I add the call function to go to the Arduino code where the shutdown is coded it doesn’t hide anything and goes immediately to the shutdown code. I’ve tried moving the event callout from ui.c to the main Arduino program and adding a 5 sec delay to allow time for it to hide everything and show the “Powering Down” label but no matter what, it does not hide everything unless I remove the function call
Screenshot or video
This is the code I am trying to run. This was generated by Squareline Studio
LVGL can only do the required changes (like hiding labels/etc. in your case) if lv_task_handler/lv_timer_handler is called. I think when you call your Arduino shut-down code directly it block further operation of lv_task_handler. You should either call lv_timer_handler() directly after hiding to facilitate the hiding and refreshment or still let it be called periodically while the shutdown process is running.
I’e changed the code to your recommendations. Both ways. Neither works to utilise the hide show. I even moved all the commands to the function and that accomplished nothing
You simply missunderstand how lvgl work. Your PowerDown(e) is called from inside lv handler then cant call handler recursive. You only need setup flags and markers and leave loop continue. Marker in loop then manage real pwdown outside lvgl. And Never use delays…
And more effective is switch to empty screen as hide …
That code was from my main arduino program. Not within the LVGL code
I got it sorted finally. But using the lvgl commands exactly in the way that was suggested did nothing. So not sure that lvgl is really understood by a lot of people
You dont show how is called, but parameter event seems call from some event reaction and this is called inside lv_handler.
Change your func last line from PowerDown( e ); to
gopowerdowntime=500;
and in loop decrement and when == 1 go deep sleep…