From 4e14d7ce3a3ac2cb78b2d42717783d83fb6bc1e3 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Wed, 18 Sep 2019 22:31:46 +0200 Subject: [PATCH] don't waste time loading --- html/planeObject.js | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index bc527b3..7d7fbd5 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -640,23 +640,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data, init) { this.position_time = receiver_timestamp - data.seen_pos; } - if (data.seen_pos < 45 && "mlat" in data && data.mlat.indexOf("lat") >= 0) { - this.dataSource = "mlat"; - } else if (this.dataSource != "uat") { - if (data.type && data.type.substring(0,4) == "tisb") - this.dataSource = "tisb"; - else if (data.type == "adsb_icao" || data.type == "adsb_other") - this.dataSource = "adsb"; - else if (data.type && data.type.substring(0,4) == "adsr") - this.dataSource = "other"; - else if (data.type == "adsb_icao_nt") - this.dataSource = "other"; - else if (this.position) - this.dataSource = "adsb"; - else - this.dataSource = "other"; - } - // remember last known altitude even if stale if (data.alt_baro != null) { this.altitude = data.alt_baro; @@ -689,14 +672,30 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data, init) { this.track = data.track; } + if (init) + return; + // don't expire callsigns if (data.flight != null) { this.flight = data.flight; } - if (init) - return; - + if (data.seen_pos < 45 && "mlat" in data && data.mlat.indexOf("lat") >= 0) { + this.dataSource = "mlat"; + } else if (this.dataSource != "uat") { + if (this.position && data.type == null) + this.dataSource = "adsb"; + else if (data.type && data.type.substring(0,4) == "tisb") + this.dataSource = "tisb"; + else if (data.type == "adsb_icao" || data.type == "adsb_other") + this.dataSource = "adsb"; + else if (data.type && data.type.substring(0,4) == "adsr") + this.dataSource = "other"; + else if (data.type == "adsb_icao_nt") + this.dataSource = "other"; + else + this.dataSource = "other"; + } // Update all of our data this.messages = data.messages;