UIFlow Timer locks code?

  • I was trying to create a timer, which envokes power saving features after x amount seconds of non use/button press of the device.
    When in this 'powersave' mode, any button will wake up the device (M5StickCplus2) again (which works).
    some snippets of code below:

    Define timer:

    Timer Callback:

    Button Press:

    Somehow the timer locks all the processes and no action can be undertaken after the screen becomes visible again.
    Any hints (or previous experience) people have with this kind of power saving methods, or is there an easier way (using UIFlow).
    NOTE: UIFLow2 doesnt really work for my use case, so I gave up on that one.

  • I think I cracked it. I hope this will help some people with the same issue.


    @ajb2k3 , I was looking at some of the comments regarding m5.lightsleep() and m5.deepsleep(). how can you wake the device up without a timer, is there a button press option?