dataSource rubbish

This commit is contained in:
Matthias Wirth
2019-08-05 08:37:26 +02:00
parent 2bb257154c
commit c76edfec7e
2 changed files with 22 additions and 40 deletions

View File

@@ -68,8 +68,8 @@ function PlaneObject(icao) {
this.tail_update = null;
// When was this last updated (receiver timestamp)
this.last_message_time = null;
this.last_position_time = null;
this.last_message_time = 0;
this.last_position_time = 0;
// When was this last updated (seconds before last update)
this.seen = null;
@@ -539,18 +539,23 @@ PlaneObject.prototype.updateIcon = function() {
PlaneObject.prototype.updateData = function(receiver_timestamp, data, init) {
// get location data first, return early if only those are needed.
if ("lat" in data && data.seen_pos < (receiver_timestamp - this.last_position_time + 2)) {
this.position = [data.lon, data.lat];
this.last_position_time = receiver_timestamp - data.seen_pos;
}
if (this.dataSource != "uat") {
if (data.seen_pos < 50 && "mlat" in data && data.mlat.indexOf("lat") >= 0)
this.dataSource = "mlat";
else if (data.addrtype && data.addrtype.substring(0,4) == "tisb")
else if (data.type && data.type.substring(0,4) == "tisb")
this.dataSource = "tisb";
else if (data.addrtype == "adsb_icao" || data.addrtype == "adsb_other")
else if (data.type == "adsb_icao" || data.type == "adsb_other")
this.dataSource = "adsb";
else if (data.addrtype && data.addrtype.substring(0,4) == "adsr")
else if (data.type && data.type.substring(0,4) == "adsr")
this.dataSource = "other";
else if (data.addrtype == "adsb_icao_nt")
else if (data.type == "adsb_icao_nt")
this.dataSource = "other";
else if (data.seen_pos < 50)
else if (this.position)
this.dataSource = "adsb";
else
this.dataSource = "other";
@@ -564,11 +569,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data, init) {
this.alt_baro = data.altitude;
}
if ("lat" in data && data.seen_pos < (receiver_timestamp - this.last_position_time + 2)) {
this.position = [data.lon, data.lat];
this.last_position_time = receiver_timestamp - data.seen_pos;
}
if ("track" in data)
this.track = data.track;
@@ -670,11 +670,13 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data, init) {
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp, init) {
// recompute seen and seen_pos
this.seen = receiver_timestamp - this.last_message_time;
this.seen_pos = (this.last_position_time != null ? receiver_timestamp - this.last_position_time : null);
this.seen_pos = receiver_timestamp - this.last_position_time;
// If no packet in over 58 seconds, clear the plane.
// Only clear the plane if it's not selected individually
if ((this.seen > 58 || this.position == null || this.seen_pos > 100)
if (this.seen_pos > 100 && (!this.selected || SelectedAllPlanes) )
this.position = null;
if ((this.seen > 58 || this.position == null)
&& (!this.selected || SelectedAllPlanes)) {
if (this.visible) {
//console.log("hiding " + this.icao);

View File

@@ -1114,17 +1114,7 @@ function refreshSelected() {
$('#selected_follow').css('font-weight', 'normal');
}
}
if (selected.dataSource == "uat") {
$('#selected_source').text("UAT");
} else if (selected.getDataSource() === "adsb_icao") {
$('#selected_source').text("ADS-B");
} else if (selected.getDataSource() === "tisb_trackfile" || selected.getDataSource() === "tisb_icao" || selected.getDataSource() === "tisb_other") {
$('#selected_source').text("TIS-B");
} else if (selected.getDataSource() === "mlat") {
$('#selected_source').text("MLAT");
} else {
$('#selected_source').text("Other");
}
$('#selected_source').text(format_data_source(selected.getDataSource()));
$('#selected_category').text(selected.category ? selected.category : "n/a");
$('#selected_sitedist').text(format_distance_long(selected.sitedist, DisplayUnits));
$('#selected_rssi').text(selected.rssi.toFixed(1) + ' dBFS');
@@ -1300,17 +1290,7 @@ function refreshHighlighted() {
$('#higlighted_icaotype').text("n/a");
}
if (highlighted.dataSource == "uat") {
$('#highlighted_source').text("UAT");
} else if (highlighted.getDataSource() === "adsb_icao") {
$('#highlighted_source').text("ADS-B");
} else if (highlighted.getDataSource() === "tisb_trackfile" || highlighted.getDataSource() === "tisb_icao" || highlighted.getDataSource() === "tisb_other") {
$('#highlighted_source').text("TIS-B");
} else if (highlighted.getDataSource() === "mlat") {
$('#highlighted_source').text("MLAT");
} else {
$('#highlighted_source').text("Other");
}
$('#highlighted_source').text(format_data_source(highlighted.getDataSource()));
if (highlighted.registration !== null) {
$('#highlighted_registration').text(highlighted.registration);
@@ -1361,17 +1341,17 @@ function refreshTableInfo() {
TrackedAircraft++;
var classes = "plane_table_row";
if (tableplane.position !== null && tableplane.seen_pos < 60) {
if (tableplane.position != null && tableplane.seen_pos < 60) {
++TrackedAircraftPositions;
}
if (tableplane.dataSource == "uat") {
classes += " uat";
} else if (tableplane.getDataSource() === "adsb_icao") {
} else if (tableplane.dataSource == "adsb") {
classes += " vPosition";
} else if (tableplane.getDataSource() === "tisb_trackfile" || tableplane.getDataSource() === "tisb_icao" || tableplane.getDataSource() === "tisb_other") {
} else if (tableplane.dataSource == "tisb") {
classes += " tisb";
} else if (tableplane.getDataSource() === "mlat") {
} else if (tableplane.dataSource == "mlat") {
classes += " mlat";
} else {
classes += " other";