Simple filter for spurious messages that make it past checksum:
don't show aircraft until we have seen 2 messages from them.
This commit is contained in:
parent
7500cabb08
commit
70e8579850
|
@ -538,7 +538,7 @@ void interactiveShowData(void) {
|
||||||
int msgs = a->messages;
|
int msgs = a->messages;
|
||||||
int flags = a->modeACflags;
|
int flags = a->modeACflags;
|
||||||
|
|
||||||
if ( (((flags & (MODEAC_MSG_FLAG )) == 0 ) )
|
if ( (((flags & (MODEAC_MSG_FLAG )) == 0 ) && (msgs > 1 ) )
|
||||||
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEA_ONLY)) == MODEAC_MSG_MODEA_ONLY) && (msgs > 4 ) )
|
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEA_ONLY)) == MODEAC_MSG_MODEA_ONLY) && (msgs > 4 ) )
|
||||||
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD )) == 0 ) && (msgs > 127) )
|
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD )) == 0 ) && (msgs > 127) )
|
||||||
) {
|
) {
|
||||||
|
|
14
net_io.c
14
net_io.c
|
@ -725,7 +725,7 @@ static const char *jsonEscapeString(const char *str) {
|
||||||
|
|
||||||
char *generateAircraftJson(const char *url_path, int *len) {
|
char *generateAircraftJson(const char *url_path, int *len) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
struct aircraft *a = Modes.aircrafts;
|
struct aircraft *a;
|
||||||
int buflen = 1024; // The initial buffer is incremented as needed
|
int buflen = 1024; // The initial buffer is incremented as needed
|
||||||
char *buf = (char *) malloc(buflen), *p = buf, *end = buf+buflen;
|
char *buf = (char *) malloc(buflen), *p = buf, *end = buf+buflen;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
@ -738,9 +738,12 @@ char *generateAircraftJson(const char *url_path, int *len) {
|
||||||
" \"aircraft\" : [",
|
" \"aircraft\" : [",
|
||||||
(int)now, Modes.stats_current.messages_total);
|
(int)now, Modes.stats_current.messages_total);
|
||||||
|
|
||||||
while(a) {
|
for (a = Modes.aircrafts; a; a = a->next) {
|
||||||
if (a->modeACflags & MODEAC_MSG_FLAG) { // skip any fudged ICAO records Mode A/C
|
if (a->modeACflags & MODEAC_MSG_FLAG) { // skip any fudged ICAO records Mode A/C
|
||||||
a = a->next;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a->msgs < 2) { // basic filter for bad decodes
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,8 +781,6 @@ char *generateAircraftJson(const char *url_path, int *len) {
|
||||||
p = buf+used;
|
p = buf+used;
|
||||||
end = buf + buflen;
|
end = buf + buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
a = a->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p += snprintf(p, end-p, "\n ]\n}\n");
|
p += snprintf(p, end-p, "\n ]\n}\n");
|
||||||
|
@ -1314,6 +1315,9 @@ static void writeFATSV() {
|
||||||
if (a->addr & MODES_NON_ICAO_ADDRESS)
|
if (a->addr & MODES_NON_ICAO_ADDRESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (a->msgs < 2) // basic filter for bad decodes
|
||||||
|
continue;
|
||||||
|
|
||||||
// don't emit if it hasn't updated since last time
|
// don't emit if it hasn't updated since last time
|
||||||
if (a->seen < a->fatsv_last_emitted) {
|
if (a->seen < a->fatsv_last_emitted) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue