Merge pull request #10 from hv92/patch-1

Fix altitude
This commit is contained in:
Junzi Sun 2017-07-21 05:58:49 -07:00 committed by GitHub
commit abafd97b3f

View File

@ -117,12 +117,12 @@ def df20alt(msg):
if mbit == '0': # unit in ft if mbit == '0': # unit in ft
if qbit == '1': # 25ft interval if qbit == '1': # 25ft interval
vbin = mbin[19:25] + mbin[26] + mbin[28:32] vbin = mbin[19:25] + mbin[26] + mbin[28:32]
alt = util.bin2int(vbin) * 25 alt = util.bin2int(vbin) * 25 - 1000
if qbit == '0': # 100ft interval if qbit == '0': # 100ft interval
# to be implemented # to be implemented
alt = None alt = None
if mbit == '1': # unit in meter if mbit == '1': # unit in meter
vbin = mbin[19:25] + mbin[26:32] vbin = mbin[19:25] + mbin[26:31]
alt = int(util.bin2int(vbin) * 3.28084) # convert to ft alt = int(util.bin2int(vbin) * 3.28084) # convert to ft
return alt return alt