get_wake_status() with Deep Sleep shield
-
I'm trying to figure out the logic of the
get_wake_status()function after going for a deep sleep or hard reset.I assume that according to the code of the deepsleep library, the wake value from the returned dictionary would be different depending on wether it's a boot from power on or after the timer has expired, right?
However, I always get a value of 16, no matter what.
Has anyone tested this functionality?
-
Did you try something like this?
from deepsleep import DeepSleep ds = DeepSleep() # get the wake reason and the value of the pins during wake up wake_s = ds.get_wake_status() print(wake_s) if wake_s['wake'] == deepsleep.PIN_WAKE: print("Pin wake up") elif wake_s['wake'] == deepsleep.TIMER_WAKE: print("Timer wake up") else: # deepsleep.POWER_ON_WAKE: print("Power ON reset")https://docs.pycom.io/chapter/datasheets/boards/deepsleep/api.html
-
@rskoniec Thanks, it helped debugging. If I unplug the power completely it shows the POWER_ON_WAKE, but if I do a manual reset (button pressed) it says TIMER_WAKE. I reckon it's a bit confusing.
I couldn't see the values after connecting the USB and reconnecting to the console, so I assumed a manual reset would be treated as a POWER_ON_WAKE.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login