Set at least airground = AG_UNCERTAIN for airborne position messages with valid altitudes.

DF18 messages don't have a CA field so we can't set airground from that.
That meant that aircraft tracking wouldn't update airground state at all from a DF18
airborne position message, even if the existing tracked airground state was stale.
It seems reasonable to set at least AG_UNCERTAIN if we're seeing airborne positions
with valid altitude data.

Fixes github issue #113
This commit is contained in:
Oliver Jowett 2021-02-18 13:53:01 +08:00
parent d8d5f2a117
commit 5a33b4ee8f
1 changed files with 5 additions and 0 deletions

View File

@ -1039,6 +1039,11 @@ static void decodeESAirbornePosition(struct modesMessage *mm, int check_imf)
altitude_unit_t unit;
int alt = decodeAC12Field(AC12Field, &unit);
if (alt != INVALID_ALTITUDE) {
// If we haven't set airground yet (e.g. DF18)
// then we can at least set it to UNCERTAIN here
if (mm->airground == AG_INVALID)
mm->airground = AG_UNCERTAIN;
if (mm->metype == 20 || mm->metype == 21 || mm->metype == 22) {
mm->altitude_geom = alt;
mm->altitude_geom_unit = unit;