Merge pull request #36 from kebwi/master

Consistent default timestamps and properly parsed empty GPVTG sentences.
master
Calvin McCoy 2022-01-06 20:27:07 -08:00 zatwierdzone przez GitHub
commit 85595da0ae
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -72,7 +72,7 @@ class MicropyGPS(object):
#####################
# Data From Sentences
# Time
self.timestamp = [0, 0, 0]
self.timestamp = [0, 0, 0.0]
self.date = [0, 0, 0]
self.local_offset = local_offset
@ -185,9 +185,9 @@ class MicropyGPS(object):
hours = (int(utc_string[0:2]) + self.local_offset) % 24
minutes = int(utc_string[2:4])
seconds = float(utc_string[4:])
self.timestamp = (hours, minutes, seconds)
self.timestamp = [hours, minutes, seconds]
else: # No Time stamp yet
self.timestamp = (0, 0, 0)
self.timestamp = [0, 0, 0.0]
except ValueError: # Bad Timestamp value present
return False
@ -283,9 +283,9 @@ class MicropyGPS(object):
hours = (int(utc_string[0:2]) + self.local_offset) % 24
minutes = int(utc_string[2:4])
seconds = float(utc_string[4:])
self.timestamp = (hours, minutes, seconds)
self.timestamp = [hours, minutes, seconds]
else: # No Time stamp yet
self.timestamp = (0, 0, 0)
self.timestamp = [0, 0, 0.0]
except ValueError: # Bad Timestamp value present
return False
@ -333,8 +333,8 @@ class MicropyGPS(object):
def gpvtg(self):
"""Parse Track Made Good and Ground Speed (VTG) Sentence. Updates speed and course"""
try:
course = float(self.gps_segments[1])
spd_knt = float(self.gps_segments[5])
course = float(self.gps_segments[1]) if self.gps_segments[1] else 0.0
spd_knt = float(self.gps_segments[5]) if self.gps_segments[5] else 0.0
except ValueError:
return False