Bi-monthly release with minor bug fixes and improvements
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
#!/usr/bin/env python3
import subprocess
from json import loads
from time import sleep
def get_gps_data():
cmd = ['gpspipe', '-w', '-n', '8']
cmd_out = subprocess.run(cmd, text=True, capture_output=True).stdout
rv = {}
for x in cmd_out.splitlines():
d = loads(x)
k = d.pop('class', None)
rv[k] = d
return rv
def check_gps_confusion():
gps = get_gps_data()
#print(gps['TPV'])
#print(gps['SKY'])
have_fix = (gps['TPV']['mode'] in [2, 3] and gps['TPV']['status'] in [1,2,3,4])
is_zero = (gps['TPV']['lat'] == 0.0 and gps['TPV']['lon'] == 0.0 and gps['TPV']['altHAE'] == 0.0)
have_sats = gps['SKY']['uSat'] > 5
return have_sats and have_fix and is_zero
def main():
if check_gps_confusion():
print("Restarting GPSD")
subprocess.run(['sudo', 'systemctl', 'restart','gpsd'])
sleep(5)
if check_gps_confusion():
print("ERROR: GPSD did not reset")
else:
print("GPS OK")
else:
print("GPS OK")
if __name__ == '__main__':
main()
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.