From d16484bf721db7f83a796d083a7a8112100dfa30 Mon Sep 17 00:00:00 2001 From: Flyer350 <57186034+Flyer350@users.noreply.github.com> Date: Thu, 26 Nov 2020 10:35:16 +0100 Subject: [PATCH] Update interrogator() in allcall.py (#86) --- pyModeS/decoder/allcall.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyModeS/decoder/allcall.py b/pyModeS/decoder/allcall.py index 5f352f4..05ef31c 100644 --- a/pyModeS/decoder/allcall.py +++ b/pyModeS/decoder/allcall.py @@ -42,8 +42,15 @@ def interrogator(msg): int: interrogator identifier code """ - # simply the CRC reminder - return common.crc(msg) + # the CRC remainder contains the CL and IC field. top three bits are CL field and last four bits are IC field. + remainder = common.crc(msg) + if remainder > 79: + IC = "corrupt IC" + elif remainder < 16: + IC="II"+str(remainder) + else: + IC="SI"+str(remainder-16) + return IC @_checkdf