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:
    0_1708506301302_uiflow_block_1708506217114.png

    Timer Callback:
    0_1708506337551_uiflow_block_1708506226713.png

    Button Press:
    0_1708506407143_uiflow_block_1708506221134.png

    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.

    0_1708581715011_uiflow_block_1708581446233.png

    @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?