Derive SPI / Alert from the airborne position message surveillance status field

This commit is contained in:
Oliver Jowett 2018-02-23 19:02:02 +00:00
parent 94824fbb98
commit 5a9350a6a1

View file

@ -903,6 +903,26 @@ static void decodeESAirbornePosition(struct modesMessage *mm, int check_imf)
unsigned char *me = mm->ME;
// 6-7: surveillance status
switch (getbits(me, 6, 7)) {
case 0:
// no status
mm->alert_valid = mm->spi_valid = 1;
mm->alert = mm->spi = 0;
break;
case 1: // permanent alert
case 2: // temporary alert
mm->alert_valid = 1;
mm->alert = 1;
// states 1/2 override state 3, so we don't know SPI status here.
break;
case 3: // SPI
// we know there's no alert in this case
mm->alert_valid = mm->spi_valid = 1;
mm->alert = 0;
mm->spi = 1;
break;
}
// 8: IMF or NIC supplement-B
if (check_imf) {