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.
pull/12/head
cintom00 2018-01-31 17:19:26 +01:00
rodzic 1a111f6359
commit 3f593e6649
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -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__":