Extract NUCp from message type; needed for #16.
This commit is contained in:
parent
e7e7f9e7c2
commit
9fd0c822f6
|
@ -381,6 +381,7 @@ struct modesMessage {
|
|||
int heading; // Reported by aircraft, or computed from from EW and NS velocity
|
||||
int raw_latitude; // Non decoded latitude.
|
||||
int raw_longitude; // Non decoded longitude.
|
||||
unsigned nuc_p; // NUCp value implied by message type
|
||||
double fLat; // Coordinates obtained from CPR encoded data if/when decoded
|
||||
double fLon; // Coordinates obtained from CPR encoded data if/when decoded
|
||||
char flight[16]; // 8 chars flight number.
|
||||
|
|
12
mode_s.c
12
mode_s.c
|
@ -838,7 +838,8 @@ static void decodeExtendedSquitter(struct modesMessage *mm)
|
|||
mm->bFlags |= MODES_ACFLAGS_HEADING_VALID;
|
||||
mm->heading = ((((msg[5] << 4) | (msg[6] >> 4)) & 0x007F) * 45) >> 4;
|
||||
}
|
||||
|
||||
|
||||
mm->nuc_p = (14 - metype);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -878,6 +879,13 @@ static void decodeExtendedSquitter(struct modesMessage *mm)
|
|||
mm->bFlags |= MODES_ACFLAGS_ALTITUDE_VALID;
|
||||
mm->altitude = decodeAC12Field(AC12Field, &mm->unit);
|
||||
}
|
||||
|
||||
if (metype == 0 || metype == 18 || metype == 22)
|
||||
mm->nuc_p = 0;
|
||||
else if (metype < 18)
|
||||
mm->nuc_p = (18 - metype);
|
||||
else
|
||||
mm->nuc_p = (29 - metype);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -986,11 +994,13 @@ static void displayExtendedSquitter(struct modesMessage *mm) {
|
|||
printf(" Global CPR decoding used.\n");
|
||||
printf(" Latitude : %f (%d)\n", mm->fLat, mm->raw_latitude);
|
||||
printf(" Longitude: %f (%d)\n", mm->fLon, mm->raw_longitude);
|
||||
printf(" NUCp: %u\n", mm->nuc_p);
|
||||
} else {
|
||||
if (!(mm->bFlags & MODES_ACFLAGS_LLEITHER_VALID))
|
||||
printf(" Bad position data, not decoded.\n");
|
||||
printf(" Latitude : %d (not decoded)\n", mm->raw_latitude);
|
||||
printf(" Longitude: %d (not decoded)\n", mm->raw_longitude);
|
||||
printf(" NUCp: %u\n", mm->nuc_p);
|
||||
}
|
||||
} else if (mm->metype == 28) { // Extended Squitter Aircraft Status
|
||||
if (mm->mesub == 1) {
|
||||
|
|
Loading…
Reference in a new issue