From 582a0d21880108583e9a112680300d82c318fd1e Mon Sep 17 00:00:00 2001 From: Flyer350 <57186034+Flyer350@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:03:34 +0100 Subject: [PATCH] DI = 1 correction for uplink messages (#157) * Update uplink.py Adding lockout for DI = 1 * Update uplink.py --- pyModeS/decoder/uplink.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyModeS/decoder/uplink.py b/pyModeS/decoder/uplink.py index fa7bf9d..bcd8e7e 100644 --- a/pyModeS/decoder/uplink.py +++ b/pyModeS/decoder/uplink.py @@ -131,7 +131,7 @@ def lockout(msg): if uf(msg) in {4, 5, 20, 21}: lockout = False di = mbytes[1] & 0x7 - if di == 7: + if (di == 1 or di == 7): # LOS if ((mbytes[3] & 0x40) >> 6) == 1: lockout = True @@ -187,10 +187,16 @@ def uplink_fields(msg): if RR > 15: BDS1 = RR - 16 BDS2 = 0 - if di == 0 or di == 1: + if di == 0: + # II + II = (mbytes[2] >> 4) & 0xF + IC = "II" + str(II) + elif di == 1: # II II = (mbytes[2] >> 4) & 0xF IC = "II" + str(II) + if ((mbytes[3] & 0x40) >> 6) == 1: + lockout = True elif di == 7: # LOS if ((mbytes[3] & 0x40) >> 6) == 1: