Skip to content

Commit

Permalink
sync: lower required precision from NUCp 6 to NUCp 5
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed May 8, 2021
1 parent 1ea56d1 commit c71c179
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mlat/client/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ def received_df17(self, message, now):
if message.altitude is None:
return # need an altitude

if message.nuc < 6:
return # need NUCp >= 6
if message.nuc < 5:
return # need NUCp >= 5

ac.recent_adsb_positions += 1

Expand Down
13 changes: 11 additions & 2 deletions modes_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,9 @@ static int decode(modesmessage *self)
if (self->valid) {
unsigned metype;

if (! (self->address = PyLong_FromLong( (self->data[1] << 16) | (self->data[2] << 8) | (self->data[3]) )))
unsigned address = (self->data[1] << 16) | (self->data[2] << 8) | (self->data[3]);
self->address = PyLong_FromLong(address);
if (!self->address)
return -1;

metype = self->data[4] >> 3;
Expand All @@ -448,6 +450,10 @@ static int decode(modesmessage *self)
else
self->nuc = 29 - metype;

if (0 && self->nuc <= 5) {
fprintf(stderr, "%06x nuc: %d\n", address, self->nuc);
}

if (self->data[6] & 0x04)
self->odd_cpr = 1;
else
Expand All @@ -459,7 +465,10 @@ static int decode(modesmessage *self)
// crude check if there is any CPR data, if either cpr_lat or cpr_lon is mostly zeros, set invalid
if ((self->data[7] == 0 && (self->data[8] & 0x7F) == 0) || (self->data[9] == 0 && self->data[10] == 0)) {
self->valid = 0;
//fprintf(stderr, "%02x %02x %02x %02x\n", self->data[7], self->data[8], self->data[9], self->data[10]);
if (0) {
fprintf(stderr, "%06x %02x %02x %02x %02x\n",
address, self->data[7], self->data[8], self->data[9], self->data[10]);
}
}
}
}
Expand Down

0 comments on commit c71c179

Please sign in to comment.