Skip to content

Commit

Permalink
gegps: Not all TPV has heading.
Browse files Browse the repository at this point in the history
Heading can be missing on gpsd startup.
  • Loading branch information
garyemiller committed Dec 2, 2017
1 parent abb0c2d commit dfb3e24
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gegps
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def kmlize(tpv):
else:
speed = 0

heading = int(round(tpv['track'], 0))
# not all TPV includes heading, like when acquiring fix
if speed >= 1 and 'track' in tpv:
heading = int(round(tpv['track'], 0))
else:
heading = 0

# not all TPV includes altitude
# like ublox8 in fixed position (time) mode
Expand All @@ -67,9 +71,6 @@ def kmlize(tpv):
else:
altitude = 0

if speed < 1:
heading = 0

return """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
Expand Down

0 comments on commit dfb3e24

Please sign in to comment.