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



  • 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.



  • @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 ๐Ÿ‘๐Ÿป



Pycom on Twitter