Skip to content

Commit 8629b4f

Browse files
1 parent e6d7ba9 commit 8629b4f

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

adafruit_gps.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,27 @@ def update(self):
121121
print(sentence)
122122
data_type, args = sentence
123123
data_type = bytes(data_type.upper(), "ascii")
124-
# return sentence
125-
if data_type in (
126-
b"GPGLL",
127-
b"GNGLL",
128-
): # GLL, Geographic Position – Latitude/Longitude
124+
(talker, sentence_type) = (data_type[:2], data_type[2:])
125+
126+
# Check for all currently known talkers
127+
# GA - Galileo
128+
# GB - BeiDou Systems
129+
# GI - NavIC
130+
# GL - GLONASS
131+
# GP - GPS
132+
# GQ - QZSS
133+
# GN - GNSS / More than one of the above
134+
if talker not in (b'GA', b'GB', b'GI', b'GL', b'GP', b'GQ', b'GN'):
135+
if self.debug:
136+
print(f" Unknown talker: {talker}")
137+
# We don't know the talker so it's not new data
138+
return False
139+
140+
if sentence_type == b'GLL': # Geographic position - Latitude/Longitude
129141
self._parse_gpgll(args)
130-
elif data_type in (b"GPRMC", b"GNRMC"): # RMC, minimum location info
142+
elif sentence_type == b'RMC': # Minimum location info
131143
self._parse_gprmc(args)
132-
elif data_type in (b"GPGGA", b"GNGGA"): # GGA, 3d location fix
144+
elif sentence_type == b'GGA': # 3D location fix
133145
self._parse_gpgga(args)
134146
return True
135147

0 commit comments

Comments
 (0)