diff --git a/comm_b.c b/comm_b.c index 0820eff..a51e1e9 100644 --- a/comm_b.c +++ b/comm_b.c @@ -57,18 +57,26 @@ void decodeCommB(struct modesMessage *mm) // This is a bit hairy as we don't know what the requested register was int bestScore = 0; CommBDecoderFn bestDecoder = NULL; + int ambiguous = 0; for (unsigned i = 0; i < (sizeof(comm_b_decoders) / sizeof(comm_b_decoders[0])); ++i) { int score = comm_b_decoders[i](mm, false); if (score > bestScore) { bestScore = score; bestDecoder = comm_b_decoders[i]; + ambiguous = 0; + } else if (score == bestScore) { + ambiguous = 1; } } if (bestDecoder) { - // decode it - bestDecoder(mm, true); + if (ambiguous) { + mm->commb_format = COMMB_AMBIGUOUS; + } else { + // decode it + bestDecoder(mm, true); + } } }