Skip to content

Commit

Permalink
Merge pull request MalcolmRobb#21 from drakeapps/master
Browse files Browse the repository at this point in the history
Update skyview with extended mode S data fields
  • Loading branch information
mutability authored Aug 17, 2018
2 parents 01a4477 + e31bee1 commit ed23dbd
Show file tree
Hide file tree
Showing 8 changed files with 933 additions and 439 deletions.
82 changes: 81 additions & 1 deletion public_html/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var UnitLabels = {
'altitude': { metric: "m", imperial: "ft", nautical: "ft"},
'speed': { metric: "km/h", imperial: "mph", nautical: "kt" },
'distance': { metric: "km", imperial: "mi", nautical: "NM" },
'verticalRate': { metric: "m/s", imperial: "ft/min", nautical: "ft/min" }
'verticalRate': { metric: "m/s", imperial: "ft/min", nautical: "ft/min" },
'distanceShort': {metric: "m", imperial: "ft", nautical: "m"}
};

// formatting helpers
Expand Down Expand Up @@ -91,6 +92,17 @@ function format_altitude_long(alt, vr, displayUnits) {
}
}

// alt ground/airborne
function format_onground (alt) {
if (alt === null) {
return "n/a";
} else if (alt === "ground") {
return "on ground";
} else {
return "airborne";
}
}

// alt in feet
function convert_altitude(alt, displayUnits) {
if (displayUnits === "metric") {
Expand Down Expand Up @@ -156,6 +168,16 @@ function format_distance_long(dist, displayUnits, fixed) {
return dist_text;
}

function format_distance_short (dist, displayUnits) {
if (dist === null) {
return "n/a";
}

var dist_text = Math.round(convert_distance_short(dist, displayUnits)) + NBSP + get_unit_label("distanceShort", displayUnits);

return dist_text;
}

// dist in meters
function convert_distance(dist, displayUnits) {
if (displayUnits === "metric") {
Expand All @@ -167,6 +189,15 @@ function convert_distance(dist, displayUnits) {
return (dist / 1852); // meters to nautical miles
}

// dist in meters
// converts meters to feet or just returns meters
function convert_distance_short(dist, displayUnits) {
if (displayUnits === "imperial") {
return (dist / 0.3048); // meters to feet
}
return dist; // just meters
}

// rate in ft/min
function format_vert_rate_brief(rate, displayUnits) {
if (rate === null || rate === undefined) {
Expand Down Expand Up @@ -225,3 +256,52 @@ function format_data_source(source) {

return "";
}

function format_nac_p (value) {
switch (value) {
case 0:
return "EPU ≥ 18.52 km";
case 1:
return "EPU < 18.52 km";
case 2:
return "EPU < 7.408 km";
case 3:
return "EPU < 3.704 km";
case 4:
return "EPU < 1852 m";
case 5:
return "EPU < 926 m";
case 6:
return "EPU < 555.6 m";
case 7:
return "EPU < 185.2 m";
case 8:
return "EPU < 92.6 m";
case 9:
return "EPU < 30 m";
case 10:
return "EPU < 10 m";
case 11:
return "EPU < 3 m";
default:
return "n/a";

}
}

function format_nac_v (value) {
switch (value) {
case 0:
return "Unknown or 10 m/s";
case 1:
return "< 10 m/s";
case 2:
return "< 3 m/s";
case 3:
return "< 1 m/s";
case 4:
return "< 0.3 m/s";
default:
return "n/a";
}
}
Binary file added public_html/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public_html/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public_html/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ed23dbd

Please sign in to comment.