From 0778587fcb099a6fb2217e0fcba74335e63a8d95 Mon Sep 17 00:00:00 2001 From: mikeller Date: Wed, 25 Sep 2019 22:11:56 +1200 Subject: [PATCH] Fixed naming of the 'Altitude' graph in the sensors tab. --- locales/en/messages.json | 11 +++++++---- src/css/tabs/sensors.css | 3 ++- src/js/tabs/sensors.js | 34 +++++++++++++++++++--------------- src/tabs/sensors.html | 13 ++++++++----- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 5cd003fc..8524d061 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -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" diff --git a/src/css/tabs/sensors.css b/src/css/tabs/sensors.css index 40466267..bb21c0d4 100644 --- a/src/css/tabs/sensors.css +++ b/src/css/tabs/sensors.css @@ -35,6 +35,7 @@ padding-left: 10px; padding-top: 10px; text-align: left; + float: left; } .tab-sensors .plot_control dl { @@ -168,4 +169,4 @@ .tab-sensors .legend .item:nth-child(4) { fill: #4DA74D; -} \ No newline at end of file +} diff --git a/src/js/tabs/sensors.js b/src/js/tabs/sensors.js index e49a5907..7a0c011e 100644 --- a/src/js/tabs/sensors.js +++ b/src/js/tabs/sensors.js @@ -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); diff --git a/src/tabs/sensors.html b/src/tabs/sensors.html index 0a274cf7..e66487aa 100644 --- a/src/tabs/sensors.html +++ b/src/tabs/sensors.html @@ -13,7 +13,7 @@
@@ -154,14 +154,17 @@
-
+
-
+
+
+
+
- @@ -178,7 +181,7 @@
- +