From 3f24f78d3a6f6170f985e14bdbb3feb3a3d3f79a Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Tue, 29 Oct 2019 22:24:59 +0100 Subject: [PATCH] fix hidden altitude() call --- pyModeS/decoder/adsb.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pyModeS/decoder/adsb.py b/pyModeS/decoder/adsb.py index e9b83ff..42a628c 100644 --- a/pyModeS/decoder/adsb.py +++ b/pyModeS/decoder/adsb.py @@ -23,7 +23,7 @@ from pyModeS.decoder import uncertainty from pyModeS.decoder.bds.bds05 import ( airborne_position, airborne_position_with_ref, - altitude, + altitude as altitude05, ) from pyModeS.decoder.bds.bds06 import ( surface_position, @@ -128,18 +128,13 @@ def altitude(msg): if tc < 5 or tc == 19 or tc > 22: raise RuntimeError("%s: Not a position message" % msg) - if tc >= 5 and tc <= 8: + elif tc >= 5 and tc <= 8: # surface position, altitude 0 return 0 - msgbin = common.hex2bin(msg) - q = msgbin[47] - if q: - n = common.bin2int(msgbin[40:47] + msgbin[48:52]) - alt = n * 25 - 1000 - return alt else: - return None + # airborn position + return altitude05(msg) def velocity(msg, rtn_sources=False):