Skip to content

Commit d22cc67

Browse files
committed
Fix to handle other nmea data string lengths
1 parent 28b2d25 commit d22cc67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_gps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def _parse_degrees(nmea_data):
8585
# this into a float or separate parts to retain the precision
8686
raw = nmea_data.split(".")
8787
deg = int(raw[0]) // 100 * 1000000 # the ddd
88-
minutes = int(raw[0]) % 100 * 10000 # the mm.
89-
minutes += int(raw[1]) # the .mmmm
90-
minutes = int(minutes / 60 * 100)
88+
minutes = int(raw[0]) % 100 # the mm.
89+
minutes += int(f"{raw[1][:4]:0<4}") / 10000 # the .mmmm
90+
minutes = int(minutes / 60 * 1000000)
9191
return deg + minutes
9292

9393

0 commit comments

Comments
 (0)