1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 13:25:24 +03:00

Added auto-hiding for settings in configuration tab if the corresponding feature isn't enabled.

This commit is contained in:
mikeller 2017-02-12 00:35:59 +13:00
parent 467745ce80
commit f31a64317a
3 changed files with 123 additions and 70 deletions

View file

@ -15,7 +15,7 @@ var Features = function (config) {
{bit: 9, group: 'other', name: 'SONAR'}, {bit: 9, group: 'other', name: 'SONAR'},
{bit: 10, group: 'other', name: 'TELEMETRY'}, {bit: 10, group: 'other', name: 'TELEMETRY'},
{bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'}, {bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'},
{bit: 12, group: 'other', name: '3D'}, {bit: 12, group: '3D', name: '3D'},
{bit: 13, group: 'rxMode', mode: 'select', name: 'RX_PARALLEL_PWM'}, {bit: 13, group: 'rxMode', mode: 'select', name: 'RX_PARALLEL_PWM'},
{bit: 14, group: 'rxMode', mode: 'select', name: 'RX_MSP'}, {bit: 14, group: 'rxMode', mode: 'select', name: 'RX_MSP'},
{bit: 15, group: 'rssi', name: 'RSSI_ADC'}, {bit: 15, group: 'rssi', name: 'RSSI_ADC'},

View file

@ -435,11 +435,6 @@
<div class="spacer_box_title" i18n="configurationGPS"></div> <div class="spacer_box_title" i18n="configurationGPS"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<div class="note">
<div class="note_spacer">
<p i18n="configurationGPSHelp"></p>
</div>
</div>
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<thead> <thead>
<tr> <tr>
@ -452,6 +447,14 @@
<!-- table generated here --> <!-- table generated here -->
</tbody> </tbody>
</table> </table>
<div class="gpsSettings">
<div class="spacer_box" style="padding-bottom:10px;">
<div class="note">
<div class="note_spacer">
<p i18n="configurationGPSHelp"></p>
</div>
</div>
</div>
<div class="line"> <div class="line">
<select class="gps_protocol"> <select class="gps_protocol">
<!-- list generated here --> <!-- list generated here -->
@ -477,11 +480,25 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="gui_box grey" style="margin-top:10px;"> <div class="gui_box grey" style="margin-top:10px;">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configuration3d"></div> <div class="spacer_box_title" i18n="configuration3d"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features 3D">
<!-- table generated here -->
</tbody>
</table>
<div class="_3dSettings">
<div class="number"> <div class="number">
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span <label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
i18n="configuration3dDeadbandLow"></span> i18n="configuration3dDeadbandLow"></span>
@ -504,6 +521,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="gui_box grey miscSettings" style="margin-top:10px;"> <div class="gui_box grey miscSettings" style="margin-top:10px;">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationMisc"></div> <div class="spacer_box_title" i18n="configurationMisc"></div>

View file

@ -562,19 +562,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
} }
$('input.feature', features_e).change(function () {
var element = $(this);
BF_CONFIG.features.updateData(element);
updateTabList(BF_CONFIG.features);
if (element.attr('name') === 'MOTOR_STOP') {
checkShowDisarmDelay();
}
});
checkShowDisarmDelay();
function checkShowSerialRxBox() { function checkShowSerialRxBox() {
if (BF_CONFIG.features.isEnabled('RX_SERIAL')) { if (BF_CONFIG.features.isEnabled('RX_SERIAL')) {
$('div.serialRXBox').show(); $('div.serialRXBox').show();
@ -623,28 +610,76 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
} }
function checkUpdateGpsControls() {
if (BF_CONFIG.features.isEnabled('GPS')) {
$('.gpsSettings').show();
} else {
$('.gpsSettings').hide();
}
}
function checkUpdate3dControls() {
if (BF_CONFIG.features.isEnabled('3D')) {
$('._3dSettings').show();
} else {
$('._3dSettings').hide();
}
}
$('input.feature', features_e).change(function () {
var element = $(this);
BF_CONFIG.features.updateData(element);
updateTabList(BF_CONFIG.features);
switch (element.attr('name')) {
case 'MOTOR_STOP':
checkShowDisarmDelay();
break;
case 'VBAT':
checkUpdateVbatControls();
break;
case 'CURRENT_METER':
checkUpdateCurrentControls();
break;
case 'GPS':
checkUpdateGpsControls();
break;
case '3D':
checkUpdate3dControls();
break;
default:
break;
}
});
$(features_e).filter('select').change(function () { $(features_e).filter('select').change(function () {
var element = $(this); var element = $(this);
BF_CONFIG.features.updateData(element); BF_CONFIG.features.updateData(element);
updateTabList(BF_CONFIG.features); updateTabList(BF_CONFIG.features);
if (element.attr('name') === 'rxMode') { switch (element.attr('name')) {
case 'rxMode':
checkShowSerialRxBox(); checkShowSerialRxBox();
break;
default:
break;
} }
}); });
$(features_e).filter('tbody.features.batteryVoltage').change(function() { checkShowDisarmDelay();
checkUpdateVbatControls();
});
$(features_e).filter('tbody.features.batteryCurrent').change(function() {
checkUpdateCurrentControls();
});
checkShowSerialRxBox(); checkShowSerialRxBox();
checkUpdateVbatControls(); checkUpdateVbatControls();
checkUpdateCurrentControls(); checkUpdateCurrentControls();
checkUpdateGpsControls();
checkUpdate3dControls();
$("input[id='unsyncedPWMSwitch']").change(function() { $("input[id='unsyncedPWMSwitch']").change(function() {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {