From 66171b62cc2778916560e9d60e69ef70851e18ab Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 19 Jun 2012 19:11:18 -0700 Subject: [PATCH] Implemented metric altitude decoding but left it commented and throwing an exception by default. --- python/altitude.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/altitude.py b/python/altitude.py index bf79943..6c2d120 100755 --- a/python/altitude.py +++ b/python/altitude.py @@ -30,8 +30,16 @@ def decode_alt(alt, bit13): qbit = alt & 0x0010 if mbit and bit13: - #TBD: bits 20-25, 27-31 encode alt in meters - #remember that bits are left justified (bit 20 is MSB) + #nobody uses metric altitude: AFAIK, it's an orphaned part of + #the spec. haven't seen it in three years. as a result, replies + #with mbit set can be considered spurious, and so we discard them here. + + #bits 20-25, 27-31 encode alt in meters + #remember that bits are LSB (bit 20 is MSB) + #meters_alt = 0 + #for (shift, bit) in enumerate(range(31,26,-1)+range(25,19,-1)): + # meters_alt += ((alt & (1<