Only set/reset position_from_mlat when we actually see position data.
Otherwise, if the position data times out on the dump1090 side, we'd keep the last seen position on the webpage side but lose the mlat status.
This commit is contained in:
parent
32f87412d6
commit
e5053ac5c9
1 changed files with 11 additions and 10 deletions
|
@ -13,6 +13,7 @@ function PlaneObject(icao) {
|
|||
this.speed = null;
|
||||
this.track = null;
|
||||
this.position = null;
|
||||
this.position_from_mlat = false
|
||||
this.sitedist = null;
|
||||
|
||||
// Data packet numbers
|
||||
|
@ -290,6 +291,16 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
|||
if (SitePosition !== null) {
|
||||
this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
|
||||
}
|
||||
|
||||
this.position_from_mlat = false;
|
||||
if (typeof data.mlat !== "undefined") {
|
||||
for (var i = 0; i < data.mlat.length; ++i) {
|
||||
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
||||
this.position_from_mlat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof data.flight !== "undefined")
|
||||
this.flight = data.flight;
|
||||
|
@ -297,16 +308,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
|||
this.squawk = data.squawk;
|
||||
if (typeof data.category !== "undefined")
|
||||
this.category = data.category;
|
||||
|
||||
this.position_from_mlat = false
|
||||
if (typeof data.mlat !== "undefined") {
|
||||
for (var i = 0; i < data.mlat.length; ++i) {
|
||||
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
||||
this.position_from_mlat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue