CRC reimplementation to be byte-at-a-time table-driven.

Also be smarter about error correction, avoiding ambiguous cases
when --aggressive is specified.
This commit is contained in:
Oliver Jowett 2015-01-20 23:04:05 +00:00
parent 0d3fcfff2e
commit 270a22e06a
8 changed files with 438 additions and 237 deletions

View file

@ -333,7 +333,11 @@ void decodeModesMessage(struct modesMessage *mm, unsigned char *msg) {
// using the results. Perhaps check the ICAO against known aircraft, and check
// IID against known good IID's. That's a TODO.
//
mm->correctedbits = fixBitErrors(msg, mm->msgbits, Modes.nfix_crc, mm->corrected);
struct errorinfo *ei = modesChecksumDiagnose(mm->crc, mm->msgbits);
if (ei != NULL && ei->errors <= Modes.nfix_crc) {
modesChecksumFix(msg, ei);
mm->correctedbits = ei->errors;
}
// If we correct, validate ICAO addr to help filter birthday paradox solutions.
if (mm->correctedbits) {