update tell()

This commit is contained in:
Junzi Sun 2019-09-24 16:30:38 +02:00
parent a683e40c41
commit e2ece806c2
2 changed files with 9 additions and 2 deletions

View File

@ -13,12 +13,15 @@ def tell(msg):
print()
df = common.df(msg)
icao = common.icao(msg)
_print("Message", msg)
_print("ICAO address", icao)
_print("Downlink Format", df)
if df == 17:
_print("Protocal", "Mode-S Extended Squitter (ADS-B)")
tc = common.typecode(msg)
if 1 <= tc <= 4: # callsign
callsign = adsb.callsign(msg)
@ -26,14 +29,17 @@ def tell(msg):
_print("Callsign:", callsign)
if 5 <= tc <= 8: # surface position
_print("Type", "Surface movment")
_print("Type", "Surface postition")
oe = adsb.oe_flag(msg)
msgbin = common.hex2bin(msg)
cprlat = common.bin2int(msgbin[54:71]) / 131072.0
cprlon = common.bin2int(msgbin[71:88]) / 131072.0
v = adsb.surface_velocity(msg)
_print("CPR format", "Odd" if oe else "Even")
_print("CPR Latitude", cprlat)
_print("CPR Longitude", cprlon)
_print("Speed", v[0], "knots")
_print("Track", v[1], "degrees")
if 9 <= tc <= 18: # airborne position
_print("Type", "Airborne position (with barometric altitude)")

View File

@ -14,6 +14,7 @@ messages = [
"A00004128F39F91A7E27C46ADC21",
]
print("-" * 70)
for m in messages:
tell(m)
print("-" * 50)
print("-" * 70)