Fixed naming of the 'Altitude' graph in the sensors tab. (#1690)
Fixed naming of the 'Altitude' graph in the sensors tab.10.7.0-preview
commit
f0a7462139
|
@ -2411,8 +2411,8 @@
|
||||||
"sensorsMagSelect": {
|
"sensorsMagSelect": {
|
||||||
"message": "Magnetometer"
|
"message": "Magnetometer"
|
||||||
},
|
},
|
||||||
"sensorsBaroSelect": {
|
"sensorsAltitudeSelect": {
|
||||||
"message": "Barometer"
|
"message": "Altitude"
|
||||||
},
|
},
|
||||||
"sensorsSonarSelect": {
|
"sensorsSonarSelect": {
|
||||||
"message": "Sonar"
|
"message": "Sonar"
|
||||||
|
@ -2429,8 +2429,11 @@
|
||||||
"sensorsMagTitle": {
|
"sensorsMagTitle": {
|
||||||
"message": "Magnetometer - Ga"
|
"message": "Magnetometer - Ga"
|
||||||
},
|
},
|
||||||
"sensorsBaroTitle": {
|
"sensorsAltitudeTitle": {
|
||||||
"message": "Barometer - meters"
|
"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": {
|
"sensorsSonarTitle": {
|
||||||
"message": "Sonar - cm"
|
"message": "Sonar - cm"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-sensors .plot_control dl {
|
.tab-sensors .plot_control dl {
|
||||||
|
@ -168,4 +169,4 @@
|
||||||
|
|
||||||
.tab-sensors .legend .item:nth-child(4) {
|
.tab-sensors .legend .item:nth-child(4) {
|
||||||
fill: #4DA74D;
|
fill: #4DA74D;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,11 +155,11 @@ TABS.sensors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function plot_baro(enable) {
|
function plot_altitude(enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
$('.wrapper.baro').show();
|
$('.wrapper.altitude').show();
|
||||||
} else {
|
} else {
|
||||||
$('.wrapper.baro').hide();
|
$('.wrapper.altitude').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ TABS.sensors.initialize = function (callback) {
|
||||||
if (!have_sensor(CONFIG.activeSensors, 'mag')) {
|
if (!have_sensor(CONFIG.activeSensors, 'mag')) {
|
||||||
checkboxes.eq(2).prop('disabled', true);
|
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);
|
checkboxes.eq(3).prop('disabled', true);
|
||||||
}
|
}
|
||||||
if (!have_sensor(CONFIG.activeSensors, 'sonar')) {
|
if (!have_sensor(CONFIG.activeSensors, 'sonar')) {
|
||||||
|
@ -222,7 +222,7 @@ TABS.sensors.initialize = function (callback) {
|
||||||
plot_mag(enable);
|
plot_mag(enable);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
plot_baro(enable);
|
plot_altitude(enable);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
plot_sonar(enable);
|
plot_sonar(enable);
|
||||||
|
@ -242,6 +242,10 @@ TABS.sensors.initialize = function (callback) {
|
||||||
ConfigStorage.set({'graphs_enabled': checkboxes});
|
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
|
// Always start with default/empty sensor data array, clean slate all
|
||||||
initSensorData();
|
initSensorData();
|
||||||
|
@ -250,13 +254,13 @@ TABS.sensors.initialize = function (callback) {
|
||||||
var samples_gyro_i = 0,
|
var samples_gyro_i = 0,
|
||||||
samples_accel_i = 0,
|
samples_accel_i = 0,
|
||||||
samples_mag_i = 0,
|
samples_mag_i = 0,
|
||||||
samples_baro_i = 0,
|
samples_altitude_i = 0,
|
||||||
samples_sonar_i = 0,
|
samples_sonar_i = 0,
|
||||||
samples_debug_i = 0,
|
samples_debug_i = 0,
|
||||||
gyro_data = initDataArray(3),
|
gyro_data = initDataArray(3),
|
||||||
accel_data = initDataArray(3),
|
accel_data = initDataArray(3),
|
||||||
mag_data = initDataArray(3),
|
mag_data = initDataArray(3),
|
||||||
baro_data = initDataArray(1),
|
altitude_data = initDataArray(1),
|
||||||
sonar_data = initDataArray(1),
|
sonar_data = initDataArray(1),
|
||||||
debug_data = [
|
debug_data = [
|
||||||
initDataArray(1),
|
initDataArray(1),
|
||||||
|
@ -268,7 +272,7 @@ TABS.sensors.initialize = function (callback) {
|
||||||
var gyroHelpers = initGraphHelpers('#gyro', samples_gyro_i, [-2000, 2000]);
|
var gyroHelpers = initGraphHelpers('#gyro', samples_gyro_i, [-2000, 2000]);
|
||||||
var accelHelpers = initGraphHelpers('#accel', samples_accel_i, [-2, 2]);
|
var accelHelpers = initGraphHelpers('#accel', samples_accel_i, [-2, 2]);
|
||||||
var magHelpers = initGraphHelpers('#mag', samples_mag_i, [-1, 1]);
|
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 sonarHelpers = initGraphHelpers('#sonar', samples_sonar_i);
|
||||||
var debugHelpers = [
|
var debugHelpers = [
|
||||||
initGraphHelpers('#debug1', samples_debug_i),
|
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),
|
'gyro': parseInt($('.tab-sensors select[name="gyro_refresh_rate"]').val(), 10),
|
||||||
'accel': parseInt($('.tab-sensors select[name="accel_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),
|
'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),
|
'sonar': parseInt($('.tab-sensors select[name="sonar_refresh_rate"]').val(), 10),
|
||||||
'debug': parseInt($('.tab-sensors select[name="debug_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())
|
'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
|
// 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"
|
// 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)
|
// 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]) {
|
if (checkboxes[3]) {
|
||||||
GUI.interval_add('altitude_pull', function altitude_data_pull() {
|
GUI.interval_add('altitude_pull', function altitude_data_pull() {
|
||||||
MSP.send_message(MSPCodes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
MSP.send_message(MSPCodes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
||||||
}, rates.baro, true);
|
}, rates.altitude, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkboxes[4]) {
|
if (checkboxes[4]) {
|
||||||
|
@ -392,10 +396,10 @@ TABS.sensors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_altitude_graph() {
|
function update_altitude_graph() {
|
||||||
updateGraphHelperSize(baroHelpers);
|
updateGraphHelperSize(altitudeHelpers);
|
||||||
|
|
||||||
samples_baro_i = addSampleToData(baro_data, samples_baro_i, [SENSOR_DATA.altitude]);
|
samples_altitude_i = addSampleToData(altitude_data, samples_altitude_i, [SENSOR_DATA.altitude]);
|
||||||
drawGraph(baroHelpers, baro_data, samples_baro_i);
|
drawGraph(altitudeHelpers, altitude_data, samples_altitude_i);
|
||||||
raw_data_text_ements.x[3].text(SENSOR_DATA.altitude.toFixed(2));
|
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_refresh_rate"]').val(result.sensor_settings.rates.mag);
|
||||||
$('.tab-sensors select[name="mag_scale"]').val(result.sensor_settings.scales.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="sonar_refresh_rate"]').val(result.sensor_settings.rates.sonar);
|
||||||
|
|
||||||
$('.tab-sensors select[name="debug_refresh_rate"]').val(result.sensor_settings.rates.debug);
|
$('.tab-sensors select[name="debug_refresh_rate"]').val(result.sensor_settings.rates.debug);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="checkboxes">
|
<div class="checkboxes">
|
||||||
<label><input type="checkbox" name="gyro_on" class="first" /><span i18n="sensorsGyroSelect"/></label> <label><input
|
<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"
|
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>
|
type="checkbox" name="sonar_on" /><span i18n="sensorsSonarSelect"/></label> <label><input type="checkbox" name="debug_on" /><span i18n="sensorsDebugSelect"/></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,14 +154,17 @@
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper baro">
|
<div class="wrapper altitude">
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey">
|
||||||
<div class="plot_control">
|
<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>
|
<dl>
|
||||||
<dt i18n="sensorsRefresh"></dt>
|
<dt i18n="sensorsRefresh"></dt>
|
||||||
<dd class="rate">
|
<dd class="rate">
|
||||||
<select name="baro_refresh_rate">
|
<select name="altitude_refresh_rate">
|
||||||
<option value="10">10 ms</option>
|
<option value="10">10 ms</option>
|
||||||
<option value="20">20 ms</option>
|
<option value="20">20 ms</option>
|
||||||
<option value="30">30 ms</option>
|
<option value="30">30 ms</option>
|
||||||
|
@ -178,7 +181,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<svg id="baro">
|
<svg id="altitude">
|
||||||
<g class="grid x" transform="translate(40, 120)"></g>
|
<g class="grid x" transform="translate(40, 120)"></g>
|
||||||
<g class="grid y" transform="translate(40, 10)"></g>
|
<g class="grid y" transform="translate(40, 10)"></g>
|
||||||
<g class="data" transform="translate(41, 10)"></g>
|
<g class="data" transform="translate(41, 10)"></g>
|
||||||
|
|
Loading…
Reference in New Issue