From e2ece806c2d36f0cf064d5b1edfba10cf238f4ee Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Tue, 24 Sep 2019 16:30:38 +0200 Subject: [PATCH] update tell() --- pyModeS/decoder/__init__.py | 8 +++++++- tests/test_tell.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyModeS/decoder/__init__.py b/pyModeS/decoder/__init__.py index 0677510..646cf38 100644 --- a/pyModeS/decoder/__init__.py +++ b/pyModeS/decoder/__init__.py @@ -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)") diff --git a/tests/test_tell.py b/tests/test_tell.py index d7f4bf6..0f27e4b 100644 --- a/tests/test_tell.py +++ b/tests/test_tell.py @@ -14,6 +14,7 @@ messages = [ "A00004128F39F91A7E27C46ADC21", ] +print("-" * 70) for m in messages: tell(m) - print("-" * 50) + print("-" * 70)