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

    Turn GPS back on after pytrack.go_to_sleep(gps=False)

    Scheduled Pinned Locked Moved WiPy 2&3
    gpspytrackdeep sleep
    2 Posts 2 Posters 736 Views 2 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.
    • A Offline
      alexpul
      last edited by

      I am using pytrack.go_to_sleep(gps=False) to enter deep sleep so that the device has minimal power draw. When the device wakes up, I can't get a GPS signal. Is there a way to turn GPS back on within the code (without resetting the device). I want to be able to use as little current as possible when in deep sleep but still have GPS functionality in wake mode.

      My current idea is to somehow reset just P22 and P21, which seem to send/receive data to/from the GPS. Any other ideas?

      I have a Pytrack with WiPy3.

      C 1 Reply Last reply Reply Quote 0
      • C Offline
        combaindeft @alexpul
        last edited by combaindeft

        @alexpul said in Turn GPS back on after pytrack.go_to_sleep(gps=False):

        I am using pytrack.go_to_sleep(gps=False)

        in the lib/pycoproc.py define your own funcion:

            def gps_state(self, gps=True):
                # enable or disable back-up power to the GPS receiver
                if gps:
                    self.set_bits_in_memory(PORTC_ADDR, 1 << 7)
                else:
                    self.mask_bits_in_memory(PORTC_ADDR, ~(1 << 7))
        

        easiest way is for you to search for "def go_to_sleep(self, gps=True)" in the file, and place your custom function above or below it :-) ...

        and then you can execute it (Turn on):

        pytrack.gps_state()
        

        and (Turn off):

        pytrack.gps_state(gps=False)
        

        good luck 👍🏻

        1 Reply Last reply Reply Quote 4

        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