Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Pysense - knowing the reset cause

    Scheduled Pinned Locked Moved Issues & Bugs
    pysensedeepsleepwake status
    3 Posts 2 Posters 1.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      lmagalhaes
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • L Offline
          lmagalhaes
          last edited by

          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 ?

          1 Reply Last reply Reply Quote 0

          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
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom