fix altitude bits
This commit is contained in:
parent
f52b00f0af
commit
658ee00b0b
|
|
@ -12,7 +12,7 @@ FEET_PER_METER = 3.28084
|
||||||
class ModeSParser(PickleModule):
|
class ModeSParser(PickleModule):
|
||||||
def process(self, input):
|
def process(self, input):
|
||||||
format = (input[0] & 0b11111000) >> 3
|
format = (input[0] & 0b11111000) >> 3
|
||||||
message = {
|
message = {
|
||||||
"mode": "ADSB",
|
"mode": "ADSB",
|
||||||
"format": format
|
"format": format
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ class ModeSParser(PickleModule):
|
||||||
elif type in range(9, 19):
|
elif type in range(9, 19):
|
||||||
# airborne position (w/ baro altitude)
|
# airborne position (w/ baro altitude)
|
||||||
q = (input[5] & 0b1)
|
q = (input[5] & 0b1)
|
||||||
altitude = ((input[5] & 0b11111110) << 3) | ((input[6] & 0b1111) >> 4)
|
altitude = ((input[5] & 0b11111110) << 3) | ((input[6] & 0b11110000) >> 4)
|
||||||
if q:
|
if q:
|
||||||
message["altitude"] = altitude * 25 - 1000
|
message["altitude"] = altitude * 25 - 1000
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue