Skip to content

Commit

Permalink
try and do MLAT for ADS-B aircraft that have a funky transponder
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Sep 23, 2020
1 parent 264b265 commit 8fb082e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
31 changes: 15 additions & 16 deletions mlat/client/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,34 +413,33 @@ def received_df17(self, message, now):
# not a position message
return

ac.last_position_time = now
if message.even_cpr:
ac.even_message = message
else:
ac.odd_message = message

if not ac.even_message or not ac.odd_message:
return
if abs(ac.even_message.timestamp - ac.odd_message.timestamp) > 5 * self.freq:
return

if message.altitude is None:
return # need an altitude

ac.last_position_time = now

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

ac.recent_adsb_positions += 1

if self.server.send_split_sync:
if not ac.requested:
return
if not ac.requested:
return

if self.server.send_split_sync:
# this is a useful reference message
self.server.send_split_sync(message)
else:
if message.even_cpr:
ac.even_message = message
else:
ac.odd_message = message

if not ac.requested:
return
if not ac.even_message or not ac.odd_message:
return
if abs(ac.even_message.timestamp - ac.odd_message.timestamp) > 5 * self.freq:
return

# this is a useful reference message pair
self.server.send_sync(ac.even_message, ac.odd_message)

Expand Down
2 changes: 1 addition & 1 deletion mlat/client/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

"""Just a version constant!"""

CLIENT_VERSION = "0.2.14"
CLIENT_VERSION = "0.2.15"
6 changes: 6 additions & 0 deletions modes_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ static int decode(modesmessage *self)

if (! (self->altitude = decode_ac12((self->data[5] << 4) | ((self->data[6] & 0xF0) >> 4))))
return -1;

// 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]);
}
}
}
break;
Expand Down

0 comments on commit 8fb082e

Please sign in to comment.