From 9d4e2230d2f762bf0251b6d12c0066f409b54483 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 29 Jul 2021 19:04:52 +0800 Subject: [PATCH] Add a few more Comm-B EMPTY_RESPONSE cases --- comm_b.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/comm_b.c b/comm_b.c index 3afc5c3..a9b08fb 100644 --- a/comm_b.c +++ b/comm_b.c @@ -87,7 +87,32 @@ void decodeCommB(struct modesMessage *mm) static int decodeEmptyResponse(struct modesMessage *mm, bool store) { - for (unsigned i = 0; i < 7; ++i) { + // 00000000000000 is a common response. Ignore it. + // + // Also, it's common to see responses that look like this: + // 40000000000000 + // 50000000000000 + // 60000000000000 + // typically in grouped bursts (one of each message) from + // the same aircraft. + // + // I speculate that these are response to interrogations for + // BDS 4,0 5,0 and 6,0 respectively where the transponder + // doesn't support the register or has no data loaded for it. + // Treat them like empty responses. + + switch (mm->MB[0]) { + case 0x00: + case 0x40: + case 0x50: + case 0x60: + break; + + default: + return 0; + } + + for (unsigned i = 1; i < 7; ++i) { if (mm->MB[i] != 0) { return 0; }