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"},
'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
@ -156,6 +157,16 @@ function format_distance_long(dist, displayUnits, fixed) {
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
function convert_distance(dist, displayUnits) {
if (displayUnits === "metric") {
@ -167,6 +178,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 * 3.28084); // meters to feet
}
return dist; // just meters
}
// rate in ft/min
function format_vert_rate_brief(rate, displayUnits) {
if (rate === null || rate === undefined) {

View file

@ -1044,7 +1044,7 @@ function refreshSelected() {
} else if (selected.rc == 0) {
$('#selected_rc').text("unknown");
} 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) {