From 17f73cc01a76ae313a7e3a38460b5144d2532627 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Fri, 26 Sep 2014 22:47:56 +0100 Subject: [PATCH] Fix preamble quiet-bits check. --- mode_s.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mode_s.c b/mode_s.c index c895ced..9bf03ed 100644 --- a/mode_s.c +++ b/mode_s.c @@ -2071,12 +2071,12 @@ void detectModeS_oversample(uint16_t *m, uint32_t mlen) { preamble[1] > preamble[2] && preamble[12] > preamble[11] && preamble[12] > preamble[13]) { - high = (preamble[1] + preamble[13]) / 2; + high = (preamble[1] + preamble[12]) / 2; } else if (preamble[3] > preamble[2] && preamble[3] > preamble[4] && preamble[9] > preamble[8] && preamble[9] > preamble[10]) { - high = (preamble[1] + preamble[9]) / 2; + high = (preamble[3] + preamble[9]) / 2; } else { // No peaks continue; @@ -2086,6 +2086,7 @@ void detectModeS_oversample(uint16_t *m, uint32_t mlen) { // of the high spikes level. We don't test bits too near to // the high levels as signals can be out of phase so part of the // energy can be in the near samples + if (preamble[5] >= high || preamble[6] >= high || preamble[7] >= high ||