set zero altitude when decoding surface message

This commit is contained in:
junzis
2017-08-03 17:18:07 +02:00
parent 854386fbd4
commit d9e277dc54

View File

@@ -469,9 +469,14 @@ def altitude(msg):
Returns:
int: altitude in feet
"""
if typecode(msg) < 9 or typecode(msg) > 18:
if typecode(msg) < 5 or typecode(msg) > 18:
raise RuntimeError("%s: Not a position message" % msg)
if typecode(msg) >=5 and typecode(msg) <=8:
# surface position, altitude 0
return 0
msgbin = util.hex2bin(msg)
q = msgbin[47]
if q: