Pysense - knowing the reset cause
-
Hi there,
In order to use my application, I need it to go into deepsleep, for battery life issues. Since I'm using the pysense board, I use the setup_sleep and go_to_sleep routines. However, how can I determine that the board woke up from deep sleep or it's the first time turning on?
In the deepsleep library, there was a get_wake_status routine, which doesn't work:
"Traceback (most recent call last):
File "main.py", line 26, in <module>
File "/flash/lib/deepsleep.py", line 145, in get_wake_status
File "/flash/lib/deepsleep.py", line 76, in peek"Since the pysense library doesn't have such a routine, how can it be determined?
Thanks,
Luís
-
The module itself won't know, as from its perspective it's just been powered on. Only the Pysense would know, but I have no idea if there's a flag somewhere that could be read to get that information.
An alternative unless Pycom chime in with details (or the sources of the Pysense PIC firmware) would be to store something in flash after the first boot, and check it back on subsequent boots.
You could also store something everytime you go to sleep with
nvs_set. -
Ok, however, let's imagine the following situation: I boot it up, it's the first boot. It checks the nvs for a certain value, it does not find it. It sets up that value saying that the next boot isn't the first. After the deepsleep, it will know that it isn't the first boot. But, if I reset the board, it will still think that it's not the first boot.
How can I get around this ?
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