From ee41c2b3cccb7fce3e9dbf04a0465a4a96a69491 Mon Sep 17 00:00:00 2001 From: Lars Lindqvist Date: Mon, 15 Aug 2016 12:53:08 +0200 Subject: [PATCH] Adjust bitmask for 13-bit altitude codes with q bit. Replaced the 14-bit 0x3F80 with 13-bit 0x1F80. (The 14-bit mask would have produced correct results as long as the input is 13 bit.) --- python/altitude.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/altitude.py b/python/altitude.py index 1824194..3519642 100755 --- a/python/altitude.py +++ b/python/altitude.py @@ -48,7 +48,7 @@ def decode_alt(alt, bit13): #in this representation, the altitude bits are as follows: # 12 11 10 9 8 7 (6) 5 (4) 3 2 1 0 # so bits 6 and 4 are the M and Q bits, respectively. - tmp1 = (alt & 0x3F80) >> 2 + tmp1 = (alt & 0x1F80) >> 2 tmp2 = (alt & 0x0020) >> 1 else: tmp1 = (alt & 0x1FE0) >> 1