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 & PyTrack sleep: get time slept (like sleep time remaining) + state saving?

    Scheduled Pinned Locked Moved Comments & Feedback
    pytrackpysensesleepaccelerometer
    2 Posts 2 Posters 942 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.
    • M Offline
      Meirssv
      last edited by

      Hello,

      Is it possible to get the amount of time the pycom module has slept (when using a PyTrack or PySense module) after waking up. Kind of like the get_sleep_remaining() function but to know how long the module was sleeping before waking up?

      Let me explain why I would need this:

      My application is sleeping for a fixed amount of time (rather long). But in the event of a wakeup by movement (from the PyTrack accelerometer) I take the LoPy back to sleep for a short time (1 minute). I keep repeating this 1 minute sleep when sensing movement. (get_wake_reason()==1: go_to_sleep(1 minute)) When no movement has been detected when waking up, I then send out a LORA-payload and go back to sleep for the long sleep time.

      -> I would like to know, when the application reaches the "send lora payload" code why it got there: because of a previous movement or because the long sleep interval was reached. This is however impossible at the moment, because of the setup of my applications workflow. That's where the amount of time the module slept would come in handy: if it was very near to the large sleeping interval, I know there was no movement, else there was a movement before.

      Other method could be to store the state in NVS, but writing this repeatedly is maybe not a good choice?

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @Meirssv
        last edited by

        @meirssv
        you can save this info to sd card, flash or nvs

        think about people first, then computers

        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