summaryrefslogtreecommitdiff
path: root/gegps
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2017-12-01 16:26:43 -0800
committerGary E. Miller <gem@rellim.com>2017-12-01 16:26:43 -0800
commitabb0c2d3159e95a4289ab2f08ffc0c8fe1383143 (patch)
tree53e54fb8f5487c9819a7fc18f5b4b6dd600998be /gegps
parent53e5afa3c465e9ce2457f2627940898ca9affbd9 (diff)
downloadgpsd-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-xgegps10
1 files changed, 8 insertions, 2 deletions
diff --git a/gegps b/gegps
index 1b3ee401..28798ce2 100755
--- a/gegps
+++ b/gegps
@@ -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