Skip to content

Commit

Permalink
Don't report that we saw an aircraft if it was probably just single-m…
Browse files Browse the repository at this point in the history
…essage noise:

Only add to the "seen" set on DF11/17/18 messages (other types
have no CRC check).

Require two messages before reporting an aircraft.

This reinstates filtering that was done at the Python level before
the filter API was added.
  • Loading branch information
mutability committed Jan 7, 2016
1 parent 00c13b8 commit 7f25d8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mlat/client/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def update_aircraft(self, now):
self.last_aircraft_update = now

def send_aircraft_report(self):
all_aircraft = {x.icao for x in self.aircraft.values()}
all_aircraft = {x.icao for x in self.aircraft.values() if x.messages > 1}
seen_ac = all_aircraft.difference(self.reported)
lost_ac = self.reported.difference(all_aircraft)

Expand Down Expand Up @@ -195,6 +195,9 @@ def periodic_stats(self, now):
adsb_req = adsb_total = modes_req = modes_total = 0
now = monotonic_time()
for ac in self.aircraft.values():
if ac.messages < 2:
continue

if now - ac.last_position_time < self.position_expiry_age:
adsb_total += 1
if ac.requested:
Expand Down
11 changes: 8 additions & 3 deletions modes_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,14 @@ static int filter_message(modesreader *self, PyObject *o)
}

if (self->seen != NULL && self->seen != Py_None) {
/* note that we saw this aircraft, even if the message is filtered */
if (PySet_Add(self->seen, message->address) < 0) {
return -1;
if (message->df == 11 || message->df == 17 || message->df == 18) {
/* note that we saw this aircraft, even if the message is filtered.
* only do this for CRC-checked messages as we get a lot of noise
* otherwise.
*/
if (PySet_Add(self->seen, message->address) < 0) {
return -1;
}
}
}

Expand Down

0 comments on commit 7f25d8e

Please sign in to comment.