diff options
author | Gary E. Miller <gem@rellim.com> | 2017-12-01 16:26:43 -0800 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2017-12-01 16:26:43 -0800 |
commit | abb0c2d3159e95a4289ab2f08ffc0c8fe1383143 (patch) | |
tree | 53e54fb8f5487c9819a7fc18f5b4b6dd600998be /gegps | |
parent | 53e5afa3c465e9ce2457f2627940898ca9affbd9 (diff) | |
download | gpsd-abb0c2d3159e95a4289ab2f08ffc0c8fe1383143.tar.gz |
gegps: Fix another crash, when no speed in TPV
On startup, a GPS may not have a speed to put in the TPV.
Diffstat (limited to 'gegps')
-rwxr-xr-x | gegps | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -50,8 +50,14 @@ def kmlize(tpv): for official kml document''' latitude = tpv['lat'] longitude = tpv['lon'] - speed_in = tpv['speed'] # meter/second - speed = speed_in * gps.MPS_TO_KPH # Km/h + + # not all TPV includes speed, like when acquiring fix + if 'speed' in tpv: + speed_in = tpv['speed'] # meter/second + speed = speed_in * gps.MPS_TO_KPH # Km/h + else: + speed = 0 + heading = int(round(tpv['track'], 0)) # not all TPV includes altitude |