Overhaul mode A/C matching to be much cheaper.

The old matching process which tracked mode A values as pseudo-aircraft
got very, very expensive with a large number of mode A/C messages (and
with lots of single-bit errors, which seems common with a Beast doing
the reception)

Instead just count A/C messages directly into a 4096-entry array (which
is very fast) and periodically scan the mode S aircraft list to see if
we can match anything up (which is fixed overhead + cost proportional
to the number of mode S aircraft)
This commit is contained in:
Oliver Jowett 2016-10-11 18:00:11 +01:00
parent 60f1f3bcb6
commit 25ea6d398b
6 changed files with 111 additions and 140 deletions

View file

@ -1806,7 +1806,7 @@ void useModesMessage(struct modesMessage *mm) {
// If this is the second message, and we
// squelched the first message, then re-emit the
// first message now.
if (!Modes.net_verbatim && a->messages == 2) {
if (!Modes.net_verbatim && a && a->messages == 2) {
modesQueueOutput(&a->first_message, a);
}
modesQueueOutput(mm, a);