Skip to content

Commit f355b6c

Browse files
committed
Added try/except function to prevent a UnicodeError when there is noise in the UART data
1 parent 35ff3b0 commit f355b6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_gps.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ def update(self):
9999
"""
100100
# Grab a sentence and check its data type to call the appropriate
101101
# parsing function.
102-
sentence = self._parse_sentence()
102+
try:
103+
sentence = self._parse_sentence()
104+
except UnicodeError:
105+
return None
103106
if sentence is None:
104107
return False
105108
if self.debug:

0 commit comments

Comments
 (0)