From b6930b424bf7141225efe8d085519e9d59b4bade Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Dec 2025 05:11:35 -0500 Subject: [PATCH] Update gps_client.py just print mode lat lon --- gps_client.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gps_client.py b/gps_client.py index a4a7dea6..5213f3e7 100644 --- a/gps_client.py +++ b/gps_client.py @@ -6,6 +6,8 @@ run this way: python3 example1.py.txt # from https://gpsd.gitlab.io/gpsd/gpsd-client-example-code.html +# this client is for the CubeSatSim Lite which does not have a Pico microcontroller + import gps # the gpsd interface module session = gps.gps(mode=gps.WATCH_ENABLE) @@ -16,21 +18,22 @@ try: # not useful, probably not a TPV message continue - print('Mode: %s(%d) Time: ' % - (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode], - session.fix.mode), end="") +# print('Mode: %s(%d) Time: ' % +# (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode], +# session.fix.mode), end="") # print time, if we have it - if gps.TIME_SET & session.valid: - print(session.fix.time, end="") - else: - print('n/a', end="") + print("%d ", session.fix.mode) +# if gps.TIME_SET & session.valid: +# print(session.fix.time, end="") +# else: +# print('n/a', end="") if ((gps.isfinite(session.fix.latitude) and gps.isfinite(session.fix.longitude))): - print(" Lat %.6f Lon %.6f" % + print(" %.6f %.6f" % (session.fix.latitude, session.fix.longitude)) else: - print(" Lat n/a Lon n/a") + print(" 0 0") except KeyboardInterrupt: # got a ^C. Say bye, bye