Update gps_client.py return -1 if no socket

pi-sensors-auto-gps
Alan Johnston 4 days ago committed by GitHub
parent cb80a03df3
commit 4454747453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,18 +11,17 @@ run this way: python3 example1.py.txt
import gps # the gpsd interface module import gps # the gpsd interface module
import time import time
session = gps.gps(mode=gps.WATCH_ENABLE)
start = time.perf_counter()
mode = -1 mode = -1
lat = 0 lat = 0
lon = 0 lon = 0
alt = 0 alt = 0
try:
session = gps.gps(mode=gps.WATCH_ENABLE)
start = time.perf_counter()
try: try:
while (session.read() == 0) and ((time.perf_counter() - start) < 2) and (mode < 2): while (session.read() == 0) and ((time.perf_counter() - start) < 2) and (mode < 2):
# print(gps.MODE_SET) # print(gps.MODE_SET)

Loading…
Cancel
Save

Powered by TurnKey Linux.