paper s3 micropython example for Power.lightSleep()
-
Tried using uiflow to do lightsleep but it just hangs and needs a power restart. Does anyone have a working sample?
-
Hello @jhfoo2
please have a look at the UIFlow2 Project Zone example I created: M5PaperS3_Light_Sleep_Test_UIFlow2.4.3
Thanks
Felix -
@felmue said in paper s3 micropython example for Power.lightSleep():
M5PaperS3_Light_Sleep_Test_UIFlow2.4.3
Thanks! I see that was able to sleep and loop, and I can add simple code to detect where it was touched that woke it up.
Can you help me understand why you put in the 1sec time.sleep()?
-
Also: I try to skip uiflow and code directly in micropython. Do you know why I can't get touched X,Y in this code:
while True: StatusLabel.setText('SLEEP') time.sleep(1) print ('sleep') Power.lightSleep(10 * 1000000, True) StatusLabel.setText('WAKE') time.sleep(1) print ('wake') time.sleep(1) M5.update() time.sleep(1) (TouchX, TouchY, _, _) = M5.Touch.getTouchPointRaw() print (f'{TouchX}, {TouchY}') -
Hi @jhfoo2
well, in my case, without the 1 second delay the UI label wasn't fully updated on the display. Or in other words, ESP32 already went into light sleep while in the background the display was still finishing to update. (In your case it might be ok without the delay as the
print()takes some time.)Edit:
I think the reason for not getting the touched X, Y is that internally the wake-up code already read the touch IC registers and by doing so cleared the values. But I could be wrong about that as it is simply a guess.I updated my example M5PaperS3_Light_Sleep_Test_UIFlow2.4.3 in the UIFlow2 Project Zone to read touch coordinates after wake-up from touch. It's a bit tricky as
M5.update()needs to be called repeatedly until the number of touch points drops back to 0.Thanks
Felix