Minor cleanups / comments.

This commit is contained in:
Oliver Jowett 2015-01-21 12:55:46 +00:00
parent a33e4388c9
commit 0493248425
2 changed files with 5 additions and 3 deletions

View file

@ -455,7 +455,6 @@ int ModeAToModeC (unsigned int ModeA);
// Functions exported from mode_s.c // Functions exported from mode_s.c
// //
int modesMessageLenByType(int type); int modesMessageLenByType(int type);
void detectModeS_oversample (uint16_t *m, uint32_t mlen);
int scoreModesMessage(unsigned char *msg, int validbits); int scoreModesMessage(unsigned char *msg, int validbits);
int decodeModesMessage (struct modesMessage *mm, unsigned char *msg); int decodeModesMessage (struct modesMessage *mm, unsigned char *msg);
void displayModesMessage(struct modesMessage *mm); void displayModesMessage(struct modesMessage *mm);

View file

@ -455,6 +455,8 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
modesChecksumFix(msg, ei); modesChecksumFix(msg, ei);
// check whether the corrected message looks sensible // check whether the corrected message looks sensible
// we are conservative here: only accept corrected messages that
// match an existing aircraft.
addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]);
if (!icaoFilterTest(addr)) { if (!icaoFilterTest(addr)) {
//fprintf(stderr, "reject: DF11 CRC error, repaired address doesn't match known ICAO\n"); //fprintf(stderr, "reject: DF11 CRC error, repaired address doesn't match known ICAO\n");
@ -478,13 +480,14 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
//fprintf(stderr, "reject: DF17/18 uncorrectable CRC error\n"); //fprintf(stderr, "reject: DF17/18 uncorrectable CRC error\n");
return -1; // couldn't fix it return -1; // couldn't fix it
} }
mm->correctedbits = ei->errors;
addr1 = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); addr1 = (msg[1] << 16) | (msg[2] << 8) | (msg[3]);
mm->correctedbits = ei->errors;
modesChecksumFix(msg, ei); modesChecksumFix(msg, ei);
addr2 = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); addr2 = (msg[1] << 16) | (msg[2] << 8) | (msg[3]);
// if the corrections touched the address, better validate it // we are conservative here: only accept corrected messages that
// match an existing aircraft.
if (addr1 != addr2 && !icaoFilterTest(addr2)) { if (addr1 != addr2 && !icaoFilterTest(addr2)) {
//fprintf(stderr, "reject: DF17/18 CRC corrected address, repaired address doesn't match known ICAO\n"); //fprintf(stderr, "reject: DF17/18 CRC corrected address, repaired address doesn't match known ICAO\n");
return -1; return -1;