Skip to content

Update adafruit_gps.py #17

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
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
5 changes: 5 additions & 0 deletions adafruit_gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def _parse_sentence(self):
# Parse any NMEA sentence that is available.
# pylint: disable=len-as-condition
# This needs to be refactored when it can be tested.

# Only continue if we have at least 64 bytes in the input buffer
if self._uart.in_waiting < 64:
return None

sentence = self._uart.readline()
if sentence is None or sentence == b'' or len(sentence) < 1:
return None
Expand Down