Skip to content

Commit

Permalink
Issue 545 - Saved station location overwritten by Object report from …
Browse files Browse the repository at this point in the history
…that station.
  • Loading branch information
wb2osz committed Sep 21, 2024
1 parent 5d7b10a commit 0734e46
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/mheard.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ void mheard_save_rf (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, r
mptr->chan = chan;
mptr->num_digi_hops = hops;
mptr->last_heard_rf = now;
// Why did I do this instead of saving the location for a position report?
mptr->dlat = G_UNKNOWN;
mptr->dlon = G_UNKNOWN;

Expand Down Expand Up @@ -446,9 +447,16 @@ void mheard_save_rf (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, r
}
}

if (A->g_lat != G_UNKNOWN && A->g_lon != G_UNKNOWN) {
mptr->dlat = A->g_lat;
mptr->dlon = A->g_lon;
// Issue 545. This was not thought out well.
// There was a case where a station sent a position report and the location was stored.
// Later, the same station sent an object report and the stations's location was overwritten
// by the object location. Solution: Save location only if position report.

if (A->g_packet_type == packet_type_position) {
if (A->g_lat != G_UNKNOWN && A->g_lon != G_UNKNOWN) {
mptr->dlat = A->g_lat;
mptr->dlon = A->g_lon;
}
}

if (mheard_debug >= 2) {
Expand Down

0 comments on commit 0734e46

Please sign in to comment.