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
|
@ -13,6 +13,7 @@ function PlaneObject(icao) {
|
||||||
this.speed = null;
|
this.speed = null;
|
||||||
this.track = null;
|
this.track = null;
|
||||||
this.position = null;
|
this.position = null;
|
||||||
|
this.position_from_mlat = false
|
||||||
this.sitedist = null;
|
this.sitedist = null;
|
||||||
|
|
||||||
// Data packet numbers
|
// Data packet numbers
|
||||||
|
@ -290,15 +291,8 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
||||||
if (SitePosition !== null) {
|
if (SitePosition !== null) {
|
||||||
this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
|
this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (typeof data.flight !== "undefined")
|
|
||||||
this.flight = data.flight;
|
|
||||||
if (typeof data.squawk !== "undefined")
|
|
||||||
this.squawk = data.squawk;
|
|
||||||
if (typeof data.category !== "undefined")
|
|
||||||
this.category = data.category;
|
|
||||||
|
|
||||||
this.position_from_mlat = false
|
this.position_from_mlat = false;
|
||||||
if (typeof data.mlat !== "undefined") {
|
if (typeof data.mlat !== "undefined") {
|
||||||
for (var i = 0; i < data.mlat.length; ++i) {
|
for (var i = 0; i < data.mlat.length; ++i) {
|
||||||
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
||||||
|
@ -307,6 +301,13 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (typeof data.flight !== "undefined")
|
||||||
|
this.flight = data.flight;
|
||||||
|
if (typeof data.squawk !== "undefined")
|
||||||
|
this.squawk = data.squawk;
|
||||||
|
if (typeof data.category !== "undefined")
|
||||||
|
this.category = data.category;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {
|
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {
|
||||||
|
|
Loading…
Reference in a new issue