Rename the ACAS stuff a bit, emit ES target state.

This commit is contained in:
Oliver Jowett 2016-08-28 12:51:03 +01:00
parent 954034855a
commit 08887642ea
2 changed files with 6 additions and 2 deletions

View file

@ -1714,7 +1714,7 @@ static void writeFATSVEvent(struct modesMessage *mm, struct aircraft *a)
else if (mm->MB[0] == 0x30 && memcmp(mm->MB, a->fatsv_emitted_bds_30, 7) != 0) {
memcpy(a->fatsv_emitted_bds_30, mm->MB, 7);
writeFATSVEventMessage(mm, "acas_ra", mm->MB, 7);
writeFATSVEventMessage(mm, "commb_acas_ra", mm->MB, 7);
}
break;
@ -1725,10 +1725,13 @@ static void writeFATSVEvent(struct modesMessage *mm, struct aircraft *a)
// first byte has the type/subtype, remaining bytes match the BDS 3,0 format
if (mm->metype == 28 && mm->mesub == 2 && memcmp(&mm->ME[1], &a->fatsv_emitted_bds_30[1], 6) != 0) {
memcpy(a->fatsv_emitted_bds_30, &mm->ME[1], 6);
writeFATSVEventMessage(mm, "acas_ra", mm->ME, 7);
writeFATSVEventMessage(mm, "es_acas_ra", mm->ME, 7);
} else if (mm->metype == 31 && (mm->mesub == 0 || mm->mesub == 1) && memcmp(mm->ME, a->fatsv_emitted_es_status, 7) != 0) {
memcpy(a->fatsv_emitted_es_status, mm->ME, 7);
writeFATSVEventMessage(mm, "es_op_status", mm->ME, 7);
} else if (mm->metype == 29 && (mm->mesub == 0 || mm->mesub == 1) && memcmp(mm->ME, a->fatsv_emitted_es_target, 7) != 0) {
memcpy(a->fatsv_emitted_es_target, mm->ME, 7);
writeFATSVEventMessage(mm, "es_target", mm->ME, 7);
}
break;
}

View file

@ -148,6 +148,7 @@ struct aircraft {
unsigned char fatsv_emitted_bds_10[7]; // -"- BDS 1,0 message
unsigned char fatsv_emitted_bds_30[7]; // -"- BDS 3,0 message
unsigned char fatsv_emitted_es_status[7]; // -"- ES operational status message
unsigned char fatsv_emitted_es_target[7]; // -"- ES target status message
uint64_t fatsv_last_emitted; // time (millis) aircraft was last FA emitted