From 54677f3ae081f90d66218677e67b975a6c5c7e82 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 9 Feb 2015 22:51:34 +0000 Subject: [PATCH] Don't try to correct >1 error in DF11. We already do this check when scoring a message for the demodulator, but there are other paths that can feed us a message so also do the check in the main decode path. --- mode_s.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mode_s.c b/mode_s.c index 2f70f1f..4d09d2b 100644 --- a/mode_s.c +++ b/mode_s.c @@ -465,6 +465,13 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg) if (!ei) { return -2; // couldn't fix it } + + // see crc.c comments: we do not attempt to fix + // more than single-bit errors, as two-bit + // errors are ambiguous in DF11. + if (ei->errors > 1) + return -2; // can't correct errors + mm->correctedbits = ei->errors; modesChecksumFix(msg, ei);