Fixed naming of the 'Altitude' graph in the sensors tab.

10.7.0-preview
mikeller 2019-09-25 22:11:56 +12:00
parent 2395c7a216
commit 0778587fcb
4 changed files with 36 additions and 25 deletions

View File

@ -2402,8 +2402,8 @@
"sensorsMagSelect": {
"message": "Magnetometer"
},
"sensorsBaroSelect": {
"message": "Barometer"
"sensorsAltitudeSelect": {
"message": "Altitude"
},
"sensorsSonarSelect": {
"message": "Sonar"
@ -2420,8 +2420,11 @@
"sensorsMagTitle": {
"message": "Magnetometer - Ga"
},
"sensorsBaroTitle": {
"message": "Barometer - meters"
"sensorsAltitudeTitle": {
"message": "Altitude - meters"
},
"sensorsAltitudeHint": {
"message": "The altitude is calculated by combining the output of the barometer (if available) with the altitude output from the GPS (if available). If a GPS connected and the GPS has a fix, the absolute altitude above sea level will be shown when disarmed. When armed, the altitude relative to the position when arming will be shown."
},
"sensorsSonarTitle": {
"message": "Sonar - cm"

View File

@ -35,6 +35,7 @@
padding-left: 10px;
padding-top: 10px;
text-align: left;
float: left;
}
.tab-sensors .plot_control dl {

View File

@ -155,11 +155,11 @@ TABS.sensors.initialize = function (callback) {
}
}
function plot_baro(enable) {
function plot_altitude(enable) {
if (enable) {
$('.wrapper.baro').show();
$('.wrapper.altitude').show();
} else {
$('.wrapper.baro').hide();
$('.wrapper.altitude').hide();
}
}
@ -194,7 +194,7 @@ TABS.sensors.initialize = function (callback) {
if (!have_sensor(CONFIG.activeSensors, 'mag')) {
checkboxes.eq(2).prop('disabled', true);
}
if (!have_sensor(CONFIG.activeSensors, 'baro')) {
if (!(have_sensor(CONFIG.activeSensors, 'baro') || (semver.gte(CONFIG.apiVersion, "1.40.0") && have_sensor(CONFIG.activeSensors, 'gps')))) {
checkboxes.eq(3).prop('disabled', true);
}
if (!have_sensor(CONFIG.activeSensors, 'sonar')) {
@ -222,7 +222,7 @@ TABS.sensors.initialize = function (callback) {
plot_mag(enable);
break;
case 3:
plot_baro(enable);
plot_altitude(enable);
break;
case 4:
plot_sonar(enable);
@ -242,6 +242,10 @@ TABS.sensors.initialize = function (callback) {
ConfigStorage.set({'graphs_enabled': checkboxes});
});
let altitudeHint_e = $('.tab-sensors #sensorsAltitudeHint');
if (semver.lt(CONFIG.apiVersion, "1.40.0")) {
altitudeHint_e.hide();
}
// Always start with default/empty sensor data array, clean slate all
initSensorData();
@ -250,13 +254,13 @@ TABS.sensors.initialize = function (callback) {
var samples_gyro_i = 0,
samples_accel_i = 0,
samples_mag_i = 0,
samples_baro_i = 0,
samples_altitude_i = 0,
samples_sonar_i = 0,
samples_debug_i = 0,
gyro_data = initDataArray(3),
accel_data = initDataArray(3),
mag_data = initDataArray(3),
baro_data = initDataArray(1),
altitude_data = initDataArray(1),
sonar_data = initDataArray(1),
debug_data = [
initDataArray(1),
@ -268,7 +272,7 @@ TABS.sensors.initialize = function (callback) {
var gyroHelpers = initGraphHelpers('#gyro', samples_gyro_i, [-2000, 2000]);
var accelHelpers = initGraphHelpers('#accel', samples_accel_i, [-2, 2]);
var magHelpers = initGraphHelpers('#mag', samples_mag_i, [-1, 1]);
var baroHelpers = initGraphHelpers('#baro', samples_baro_i);
var altitudeHelpers = initGraphHelpers('#altitude', samples_altitude_i);
var sonarHelpers = initGraphHelpers('#sonar', samples_sonar_i);
var debugHelpers = [
initGraphHelpers('#debug1', samples_debug_i),
@ -300,7 +304,7 @@ TABS.sensors.initialize = function (callback) {
'gyro': parseInt($('.tab-sensors select[name="gyro_refresh_rate"]').val(), 10),
'accel': parseInt($('.tab-sensors select[name="accel_refresh_rate"]').val(), 10),
'mag': parseInt($('.tab-sensors select[name="mag_refresh_rate"]').val(), 10),
'baro': parseInt($('.tab-sensors select[name="baro_refresh_rate"]').val(), 10),
'altitude': parseInt($('.tab-sensors select[name="altitude_refresh_rate"]').val(), 10),
'sonar': parseInt($('.tab-sensors select[name="sonar_refresh_rate"]').val(), 10),
'debug': parseInt($('.tab-sensors select[name="debug_refresh_rate"]').val(), 10)
};
@ -311,7 +315,7 @@ TABS.sensors.initialize = function (callback) {
'mag': parseFloat($('.tab-sensors select[name="mag_scale"]').val())
};
// handling of "data pulling" is a little bit funky here, as MSP_RAW_IMU contains values for gyro/accel/mag but not baro
// handling of "data pulling" is a little bit funky here, as MSP_RAW_IMU contains values for gyro/accel/mag but not altitude
// this means that setting a slower refresh rate on any of the attributes would have no effect
// what we will do instead is = determinate the fastest refresh rate for those 3 attributes, use that as a "polling rate"
// and use the "slower" refresh rates only for re-drawing the graphs (to save resources/computing power)
@ -344,7 +348,7 @@ TABS.sensors.initialize = function (callback) {
if (checkboxes[3]) {
GUI.interval_add('altitude_pull', function altitude_data_pull() {
MSP.send_message(MSPCodes.MSP_ALTITUDE, false, false, update_altitude_graph);
}, rates.baro, true);
}, rates.altitude, true);
}
if (checkboxes[4]) {
@ -392,10 +396,10 @@ TABS.sensors.initialize = function (callback) {
}
function update_altitude_graph() {
updateGraphHelperSize(baroHelpers);
updateGraphHelperSize(altitudeHelpers);
samples_baro_i = addSampleToData(baro_data, samples_baro_i, [SENSOR_DATA.altitude]);
drawGraph(baroHelpers, baro_data, samples_baro_i);
samples_altitude_i = addSampleToData(altitude_data, samples_altitude_i, [SENSOR_DATA.altitude]);
drawGraph(altitudeHelpers, altitude_data, samples_altitude_i);
raw_data_text_ements.x[3].text(SENSOR_DATA.altitude.toFixed(2));
}
@ -431,7 +435,7 @@ TABS.sensors.initialize = function (callback) {
$('.tab-sensors select[name="mag_refresh_rate"]').val(result.sensor_settings.rates.mag);
$('.tab-sensors select[name="mag_scale"]').val(result.sensor_settings.scales.mag);
$('.tab-sensors select[name="baro_refresh_rate"]').val(result.sensor_settings.rates.baro);
$('.tab-sensors select[name="altitude_refresh_rate"]').val(result.sensor_settings.rates.altitude);
$('.tab-sensors select[name="sonar_refresh_rate"]').val(result.sensor_settings.rates.sonar);
$('.tab-sensors select[name="debug_refresh_rate"]').val(result.sensor_settings.rates.debug);

View File

@ -13,7 +13,7 @@
<div class="checkboxes">
<label><input type="checkbox" name="gyro_on" class="first" /><span i18n="sensorsGyroSelect"/></label> <label><input
type="checkbox" name="accel_on" /><span i18n="sensorsAccelSelect"/></label> <label><input type="checkbox"
name="mag_on" /><span i18n="sensorsMagSelect"/></label> <label><input type="checkbox" name="baro_on" /><span i18n="sensorsBaroSelect"/></label> <label><input
name="mag_on" /><span i18n="sensorsMagSelect"/></label> <label><input type="checkbox" name="altitude_on" /><span i18n="sensorsAltitudeSelect"/></label> <label><input
type="checkbox" name="sonar_on" /><span i18n="sensorsSonarSelect"/></label> <label><input type="checkbox" name="debug_on" /><span i18n="sensorsDebugSelect"/></label>
</div>
</div>
@ -154,14 +154,17 @@
<div class="clear-both"></div>
</div>
</div>
<div class="wrapper baro">
<div class="wrapper altitude">
<div class="gui_box grey">
<div class="plot_control">
<div class="title" i18n="sensorsBaroTitle"></div>
<div>
<div class="title" i18n="sensorsAltitudeTitle"></div>
<div id="sensorsAltitudeHint" class="helpicon cf_tip" i18n_title="sensorsAltitudeHint"/>
</div>
<dl>
<dt i18n="sensorsRefresh"></dt>
<dd class="rate">
<select name="baro_refresh_rate">
<select name="altitude_refresh_rate">
<option value="10">10 ms</option>
<option value="20">20 ms</option>
<option value="30">30 ms</option>
@ -178,7 +181,7 @@
</dl>
</div>
<svg id="baro">
<svg id="altitude">
<g class="grid x" transform="translate(40, 120)"></g>
<g class="grid y" transform="translate(40, 10)"></g>
<g class="data" transform="translate(41, 10)"></g>