mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-17 05:15:20 +03:00
Report raw baro altitude in sensors tab
This commit is contained in:
parent
97341e95ca
commit
191aa6ac86
4 changed files with 26 additions and 16 deletions
1
js/fc.js
1
js/fc.js
|
@ -162,6 +162,7 @@ var FC = {
|
|||
accelerometer: [0, 0, 0],
|
||||
magnetometer: [0, 0, 0],
|
||||
altitude: 0,
|
||||
barometer: 0,
|
||||
sonar: 0,
|
||||
kinematics: [0.0, 0.0, 0.0],
|
||||
debug: [0, 0, 0, 0]
|
||||
|
|
|
@ -177,6 +177,10 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP_ALTITUDE:
|
||||
SENSOR_DATA.altitude = parseFloat((data.getInt32(0, true) / 100.0).toFixed(2)); // correct scale factor
|
||||
// On 1.6 and above this provides also baro raw altitude
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
|
||||
SENSOR_DATA.barometer = parseFloat((data.getInt32(6, true) / 100.0).toFixed(2)); // correct scale factor
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SONAR:
|
||||
SENSOR_DATA.sonar = data.getInt32(0, true);
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
<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">Barometer - meters</div>
|
||||
|
@ -177,12 +177,14 @@
|
|||
<option value="1000">1000 ms</option>
|
||||
</select>
|
||||
</dd>
|
||||
<dt>X:</dt>
|
||||
<dt>Alt:</dt>
|
||||
<dd class="x">0</dd>
|
||||
<dt>Baro:</dt>
|
||||
<dd class="y">0</dd>
|
||||
</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>
|
||||
|
|
|
@ -156,11 +156,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,9 +186,6 @@ TABS.sensors.initialize = function (callback) {
|
|||
|
||||
// disable graphs for sensors that are missing
|
||||
var checkboxes = $('.tab-sensors .info .checkboxes input');
|
||||
if (!bit_check(CONFIG.activeSensors, 1)) { // baro
|
||||
checkboxes.eq(3).prop('disabled', true);
|
||||
}
|
||||
if (!bit_check(CONFIG.activeSensors, 2)) { // mag
|
||||
checkboxes.eq(2).prop('disabled', true);
|
||||
}
|
||||
|
@ -211,7 +208,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
plot_mag(enable);
|
||||
break;
|
||||
case 3:
|
||||
plot_baro(enable);
|
||||
plot_altitude(enable);
|
||||
break;
|
||||
case 4:
|
||||
plot_sonar(enable);
|
||||
|
@ -249,13 +246,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 = (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) ? initDataArray(2) : initDataArray(1),
|
||||
sonar_data = initDataArray(1),
|
||||
debug_data = [
|
||||
initDataArray(1),
|
||||
|
@ -267,7 +264,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),
|
||||
|
@ -452,11 +449,17 @@ 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);
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
|
||||
samples_altitude_i = addSampleToData(altitude_data, samples_altitude_i, [SENSOR_DATA.altitude, SENSOR_DATA.barometer]);
|
||||
}
|
||||
else {
|
||||
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));
|
||||
raw_data_text_ements.y[3].text(SENSOR_DATA.barometer.toFixed(2));
|
||||
}
|
||||
|
||||
function update_sonar_graphs() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue