Move setting of CF earlier so we can use its value while decoding AA.

(Needed to notice non-ICAO addresses in TIS-B)
This commit is contained in:
Oliver Jowett 2015-01-22 22:19:38 +00:00
parent 07c4f045aa
commit 5020d75b9e

View file

@ -542,6 +542,12 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
mm->bFlags = 0; mm->bFlags = 0;
// CF (Control field)
// done first so we can use it in AA.
if (mm->msgtype == 18) {
mm->cf = msg[0] & 7;
}
// AA (Address announced) // AA (Address announced)
if (mm->msgtype == 11 || mm->msgtype == 17 || mm->msgtype == 18) { if (mm->msgtype == 11 || mm->msgtype == 17 || mm->msgtype == 18) {
mm->addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); mm->addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]);
@ -581,11 +587,6 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
// CC (Cross-link capability) not decoded // CC (Cross-link capability) not decoded
// CF (Control field)
if (mm->msgtype == 18) {
mm->cf = msg[0] & 7;
}
// DR (Downlink Request) not decoded // DR (Downlink Request) not decoded
// FS (Flight Status) // FS (Flight Status)