Just use ft/m for the Rc display

This commit is contained in:
James Wilson 2018-08-03 18:39:13 -05:00
parent 3ec6ec1a9d
commit 540e5f8e95
2 changed files with 22 additions and 2 deletions

View file

@ -12,7 +12,8 @@ var UnitLabels = {
'altitude': { metric: "m", imperial: "ft", nautical: "ft"}, 'altitude': { metric: "m", imperial: "ft", nautical: "ft"},
'speed': { metric: "km/h", imperial: "mph", nautical: "kt" }, 'speed': { metric: "km/h", imperial: "mph", nautical: "kt" },
'distance': { metric: "km", imperial: "mi", nautical: "NM" }, '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 // formatting helpers
@ -156,6 +157,16 @@ function format_distance_long(dist, displayUnits, fixed) {
return dist_text; return dist_text;
} }
function format_distace_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 // dist in meters
function convert_distance(dist, displayUnits) { function convert_distance(dist, displayUnits) {
if (displayUnits === "metric") { if (displayUnits === "metric") {
@ -167,6 +178,15 @@ function convert_distance(dist, displayUnits) {
return (dist / 1852); // meters to nautical miles 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 * 3.28084); // meters to feet
}
return dist; // just meters
}
// rate in ft/min // rate in ft/min
function format_vert_rate_brief(rate, displayUnits) { function format_vert_rate_brief(rate, displayUnits) {
if (rate === null || rate === undefined) { if (rate === null || rate === undefined) {

View file

@ -1044,7 +1044,7 @@ function refreshSelected() {
} else if (selected.rc == 0) { } else if (selected.rc == 0) {
$('#selected_rc').text("unknown"); $('#selected_rc').text("unknown");
} else { } else {
$('#selected_rc').text(format_distance_long(selected.rc, DisplayUnits)); $('#selected_rc').text(format_distace_short(selected.rc, DisplayUnits));
} }
if (selected.sil == null || selected.sil_type == null) { if (selected.sil == null || selected.sil_type == null) {