1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 12:55:13 +03:00

disable checkboxes and plots according to sensors

This commit is contained in:
cTn 2014-05-08 15:58:52 +02:00
parent 2f5d214067
commit 05f06075b2
5 changed files with 24 additions and 8 deletions

View file

@ -1,3 +1,7 @@
<span>05.08.2014 - 0.39</span>
<p>
- UI enhancements for sensors tab<br />
</p>
<span>05.08.2014 - 0.38</span>
<p>
- Bugfix for firmware flasher UI<br />

View file

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"minimum_chrome_version": "33",
"version": "0.38",
"version": "0.39",
"author": "cTn",
"name": "Baseflight - Configurator",

View file

@ -12,7 +12,10 @@
}
.tab-sensors .info input {
vertical-align: middle;
margin: 0 10px 0 5px;
margin: 0 5px 0 15px;
}
.tab-sensors .info .first {
margin: 0 5px 0 0;
}
.tab-sensors .wrapper {
display: none;

View file

@ -6,11 +6,11 @@
We recommend to only render graphs for sensors you are interested in while using reasonable update periods.
</p>
<div class="checkboxes">
<label>Gyroscope <input type="checkbox" name="gyro_on" /></label>
<label>Accelerometer <input type="checkbox" name="accel_on" /></label>
<label>Magnetometer <input type="checkbox" name="mag_on" /></label>
<label>Barometer <input type="checkbox" name="baro_on" /></label>
<label>Debug <input type="checkbox" name="debug_on" /></label>
<label><input type="checkbox" name="gyro_on" class="first" />Gyroscope</label>
<label><input type="checkbox" name="accel_on" />Accelerometer</label>
<label><input type="checkbox" name="mag_on" />Magnetometer</label>
<label><input type="checkbox" name="baro_on" />Barometer</label>
<label><input type="checkbox" name="debug_on" />Debug</label>
</div>
</div>
<div class="wrapper gyro">

View file

@ -168,6 +168,15 @@ function tab_initialize_sensors() {
// translate to user-selected language
localize();
// 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);
}
$('.tab-sensors .info .checkboxes input').change(function() {
var enable = $(this).prop('checked');
var index = $(this).parent().index();
@ -204,7 +213,7 @@ function tab_initialize_sensors() {
if (result.graphs_enabled) {
var checkboxes = $('.tab-sensors .info .checkboxes input');
for (var i = 0; i < result.graphs_enabled.length; i++) {
checkboxes.eq(i).prop('checked', result.graphs_enabled[i]).change();
checkboxes.eq(i).not(':disabled').prop('checked', result.graphs_enabled[i]).change();
}
} else {
$('.tab-sensors .info input:lt(4)').prop('checked', true).change();