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
+6 -1
View File
@@ -469,9 +469,14 @@ def altitude(msg):
Returns: Returns:
int: altitude in feet 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) 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) msgbin = util.hex2bin(msg)
q = msgbin[47] q = msgbin[47]
if q: if q: