set zero altitude when decoding surface message
This commit is contained in:
+6
-1
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user