Skip to content

Commit

Permalink
pos reliability minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Jun 13, 2022
1 parent 59b4550 commit ca5b825
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions track.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,23 @@ static void setPosition(struct aircraft *a, struct modesMessage *mm, int64_t now

if (posReliable(a) && accept_data(&a->pos_reliable_valid, mm->source, mm, a, 2)) {

// when accepting crappy positions, invalidate the data indicating position accuracy
if (mm->source < SOURCE_TISB) {
// a->nic_baro_valid.source = SOURCE_INVALID;
a->nac_p_valid.source = SOURCE_INVALID;
a->nac_v_valid.source = SOURCE_INVALID;
a->sil_valid.source = SOURCE_INVALID;
a->gva_valid.source = SOURCE_INVALID;
a->sda_valid.source = SOURCE_INVALID;
a->sil_type = SIL_INVALID;
}

set_globe_index(a, globe_index(a->lat, a->lon));

if (0 && a->addr == Modes.trace_focus) {
fprintf(stderr, "%5.1fs traceAdd: %06x\n", (now % (600 * SECONDS)) / 1000.0, a->addr);
}


a->lastPosReceiverId = mm->receiverId;

// update addrtype, we use the type from the accepted position.
Expand All @@ -953,18 +963,6 @@ static void setPosition(struct aircraft *a, struct modesMessage *mm, int64_t now
a->seenAdsbReliable = now;
}

// when accepting crappy positions, invalidate the data indicating position accuracy
if (mm->source < SOURCE_TISB) {
// a->nic_baro_valid.source = SOURCE_INVALID;
a->nac_p_valid.source = SOURCE_INVALID;
a->nac_v_valid.source = SOURCE_INVALID;
a->sil_valid.source = SOURCE_INVALID;
a->gva_valid.source = SOURCE_INVALID;
a->sda_valid.source = SOURCE_INVALID;
a->sil_type = SIL_INVALID;
}


if (Modes.userLocationValid) {

if (mm->receiver_distance == 0) {
Expand All @@ -985,7 +983,9 @@ static void setPosition(struct aircraft *a, struct modesMessage *mm, int64_t now
}
}


if (0 && a->addr == Modes.cpr_focus) {
fprintf(stderr, "%06x: reliability odd: %3.1f even: %3.1f status: %d\n", a->addr, a->pos_reliable_odd, a->pos_reliable_even, posReliable(a));
}
}

static void updatePosition(struct aircraft *a, struct modesMessage *mm, int64_t now) {
Expand Down Expand Up @@ -3246,7 +3246,7 @@ static void incrementReliable(struct aircraft *a, struct modesMessage *mm, int64
a->pos_reliable_odd = fminf(a->pos_reliable_odd + increment, Modes.position_persistence);

if (!odd || odd == 2)
a->pos_reliable_even = imin(a->pos_reliable_even + increment, Modes.position_persistence);
a->pos_reliable_even = fminf(a->pos_reliable_even + increment, Modes.position_persistence);
}

static void position_bad(struct modesMessage *mm, struct aircraft *a) {
Expand Down

0 comments on commit ca5b825

Please sign in to comment.