Retain callsign even after it disappears from json.

This commit is contained in:
Oliver Jowett 2017-06-16 13:30:30 +01:00
parent c6d7f1ec6f
commit 4baae970ae

View file

@ -432,7 +432,7 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
var fields = ["altitude", "alt_geom", "gs", "ias", "tas", "track", var fields = ["altitude", "alt_geom", "gs", "ias", "tas", "track",
"track_rate", "mag_heading", "true_heading", "mach", "track_rate", "mag_heading", "true_heading", "mach",
"roll", "intent_alt", "intent_heading", "intent_modes", "roll", "intent_alt", "intent_heading", "intent_modes",
"alt_setting", "baro_rate", "geom_rate", "flight", "alt_setting", "baro_rate", "geom_rate",
"squawk", "category", "version"]; "squawk", "category", "version"];
for (var i = 0; i < fields.length; ++i) { for (var i = 0; i < fields.length; ++i) {
@ -450,6 +450,10 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
else else
this.addrtype = 'adsb_icao'; this.addrtype = 'adsb_icao';
// don't expire callsigns
if ('flight' in data)
this.flight = data.flight;
if ('lat' in data && 'lon' in data) { if ('lat' in data && 'lon' in data) {
this.position = [data.lon, data.lat]; this.position = [data.lon, data.lat];
this.last_position_time = receiver_timestamp - data.seen_pos; this.last_position_time = receiver_timestamp - data.seen_pos;