diff --git a/dump1090.h b/dump1090.h index 979570e..5f8ce7f 100644 --- a/dump1090.h +++ b/dump1090.h @@ -164,6 +164,7 @@ #define MODES_ACFLAGS_NSEWSPD_VALID (1<<14) // Aircraft EW and NS Speed is known #define MODES_ACFLAGS_LATLON_REL_OK (1<<15) // Indicates it's OK to do a relative CPR #define MODES_ACFLAGS_REL_CPR_USED (1<<16) // Lat/lon derived from relative CPR +#define MODES_ACFLAGS_NON_ICAO (1<<17) // Address is not ICAO-format #define MODES_ACFLAGS_LLEITHER_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID) #define MODES_ACFLAGS_LLBOTH_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID) diff --git a/interactive.c b/interactive.c index eee61f5..fc44b38 100644 --- a/interactive.c +++ b/interactive.c @@ -601,8 +601,9 @@ void interactiveShowData(void) { snprintf(strFl, 6, "%5d", altitude); } - printf("%06X %-4s %-4s %-8s %5s %3s %3s %7s %8s %5.1f %5d %2d\n", - a->addr, strMode, strSquawk, a->flight, strFl, strGs, strTt, + printf("%06X%s %-4s %-4s %-8s %5s %3s %3s %7s %8s %5.1f %5d %2d\n", + a->addr, (a->bFlags & MODES_ACFLAGS_NON_ICAO) ? "~" : " ", + strMode, strSquawk, a->flight, strFl, strGs, strTt, strLat, strLon, 10 * log10(signalAverage), msgs, (int)(now - a->seen)); } count++; diff --git a/mode_ac.c b/mode_ac.c index b168e37..04e522d 100644 --- a/mode_ac.c +++ b/mode_ac.c @@ -371,6 +371,7 @@ void decodeModeAMessage(struct modesMessage *mm, int ModeA) // Set the Identity field to ModeA mm->modeA = ModeA & 0x7777; mm->bFlags |= MODES_ACFLAGS_SQUAWK_VALID; + mm->bFlags |= MODES_ACFLAGS_NON_ICAO; // Flag ident in flight status mm->fs = ModeA & 0x0080; diff --git a/mode_s.c b/mode_s.c index 1271d7d..0df3d4a 100644 --- a/mode_s.c +++ b/mode_s.c @@ -543,7 +543,10 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg) // AA (Address announced) if (mm->msgtype == 11 || mm->msgtype == 17 || mm->msgtype == 18) { mm->addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); - if (!mm->correctedbits && (mm->msgtype != 11 || mm->iid == 0)) { + + if (mm->msgtype == 18 && (mm->cf != 0 && mm->cf != 6)) + mm->bFlags |= MODES_ACFLAGS_NON_ICAO; // DF 18 message not using ICAO addressing + else if (!mm->correctedbits && (mm->msgtype != 11 || mm->iid == 0)) { // No CRC errors seen, and either it was an DF17/18 extended squitter // or a DF11 acquisition squitter with II = 0. We probably have the right address.