Skip to content

Update RMC parsing to handle the extra parameter in NMEA 4.1 #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions adafruit_gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
_GSV11 = 6
_GSV15 = 7
_GSV19 = 8
_RMC_4_1 = 9
_ST_MIN = _GLL
_ST_MAX = _GSV19
_ST_MAX = _RMC_4_1

_SENTENCE_PARAMS = (
# 0 - _GLL
Expand All @@ -66,6 +67,8 @@
"iiiiiiIiiiIiiiI",
# 8 - _GSV19
"iiiiiiIiiiIiiiIiiiI",
# 9 - _RMC_4_1
"fcdcdcffiDCCC",
)


Expand Down Expand Up @@ -439,9 +442,9 @@ def _parse_gll(self, data):
def _parse_rmc(self, data):
# RMC - Recommended Minimum Navigation Information

if data is None or len(data) != 12:
if data is None or len(data) not in (12, 13):
return False # Unexpected number of params.
data = _parse_data(_RMC, data)
data = _parse_data({12: _RMC, 13: _RMC_4_1}[len(data)], data)
if data is None:
return False # Params didn't parse

Expand Down
2 changes: 1 addition & 1 deletion examples/gps_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
if gps.horizontal_dilution is not None:
print("Horizontal dilution: {}".format(gps.horizontal_dilution))
if gps.height_geoid is not None:
print("Height geo ID: {} meters".format(gps.height_geoid))
print("Height geoid: {} meters".format(gps.height_geoid))