From 3f593e66496953f360c8856c4b4fe6e61a9d86e4 Mon Sep 17 00:00:00 2001 From: cintom00 Date: Wed, 31 Jan 2018 17:19:26 +0100 Subject: [PATCH] Added supported sentences for Beitian GPS-module The Beitian BN-880 appears to use slightly different NEMA sentences. By adding these sentences and calling the methods which already exist everything seems to work as expected. This was tested on an ESP32. The extra exception catching was needed to prevent the program from crashing in case a "list index out of range" exception was thrown. --- micropyGPS.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/micropyGPS.py b/micropyGPS.py index 619190c..a4ce284 100644 --- a/micropyGPS.py +++ b/micropyGPS.py @@ -497,21 +497,29 @@ class MicropyGPS(object): sat_id = int(self.gps_segments[sats]) except ValueError: return False + except Exception: + return False try: # elevation can be null (no value) when not tracking elevation = int(self.gps_segments[sats+1]) except ValueError: elevation = None + except Exception: + elevation = None try: # azimuth can be null (no value) when not tracking azimuth = int(self.gps_segments[sats+2]) except ValueError: azimuth = None + except Exception: + azimuth = None try: # SNR can be null (no value) when not tracking snr = int(self.gps_segments[sats+3]) except ValueError: snr = None + except Exception: + snr = None # If no PRN is found, then the sentence has no more satellites to read else: @@ -809,6 +817,8 @@ class MicropyGPS(object): 'GPGSA': gpgsa, 'GLGSA': gpgsa, 'GPGSV': gpgsv, 'GLGSV': gpgsv, 'GPGLL': gpgll, 'GLGLL': gpgll, + 'GNGGA': gpgga, 'GNRMC': gprmc, + 'GNVTG': gpvtg, } if __name__ == "__main__":