1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 21:35:33 +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,28 +447,37 @@
<!-- table generated here --> <!-- table generated here -->
</tbody> </tbody>
</table> </table>
<div class="line"> <div class="gpsSettings">
<select class="gps_protocol"> <div class="spacer_box" style="padding-bottom:10px;">
<!-- list generated here --> <div class="note">
</select> <div class="note_spacer">
<span i18n="configurationGPSProtocol"></span> <p i18n="configurationGPSHelp"></p>
</div> </div>
<div class="line"> </div>
<select class="gps_baudrate"> </div>
<!-- list generated here --> <div class="line">
</select> <select class="gps_protocol">
<span i18n="configurationGPSBaudrate"></span> <!-- list generated here -->
</div> </select>
<div class="line"> <span i18n="configurationGPSProtocol"></span>
<select class="gps_ubx_sbas"> </div>
<!-- list generated here --> <div class="line">
</select> <select class="gps_baudrate">
<span i18n="configurationGPSubxSbas"></span> <!-- list generated here -->
</div> </select>
<div class="number"> <span i18n="configurationGPSBaudrate"></span>
<label> <input type="number" name="mag_declination" step="0.01" min="-180" max="180" /> </div>
<span i18n="configurationMagDeclination"></span> <div class="line">
</label> <select class="gps_ubx_sbas">
<!-- list generated here -->
</select>
<span i18n="configurationGPSubxSbas"></span>
</div>
<div class="number">
<label> <input type="number" name="mag_declination" step="0.01" min="-180" max="180" />
<span i18n="configurationMagDeclination"></span>
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -482,25 +486,39 @@
<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">
<div class="number"> <table cellpadding="0" cellspacing="0">
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span <thead>
i18n="configuration3dDeadbandLow"></span> <tr>
</label> <th i18n="configurationFeatureEnabled"></th>
</div> <th i18n="configurationFeatureDescription"></th>
<div class="number"> <th i18n="configurationFeatureName"></th>
<label> <input type="number" name="3ddeadbandhigh" step="1" min="1500" max="1575" /> <span </tr>
i18n="configuration3dDeadbandHigh"></span> </thead>
</label> <tbody class="features 3D">
</div> <!-- table generated here -->
<div class="number"> </tbody>
<label> <input type="number" name="3dneutral" step="1" min="1475" max="1525" /> <span </table>
i18n="configuration3dNeutral"></span> <div class="_3dSettings">
</label> <div class="number">
</div> <label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
<div class="number" > i18n="configuration3dDeadbandLow"></span>
<label> <input type="number" name="3ddeadbandthrottle" step="1" min="0" max="1000" /> <span </label>
i18n="configuration3dDeadbandThrottle"></span> </div>
</label> <div class="number">
<label> <input type="number" name="3ddeadbandhigh" step="1" min="1500" max="1575" /> <span
i18n="configuration3dDeadbandHigh"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="3dneutral" step="1" min="1475" max="1525" /> <span
i18n="configuration3dNeutral"></span>
</label>
</div>
<div class="number" >
<label> <input type="number" name="3ddeadbandthrottle" step="1" min="0" max="1000" /> <span
i18n="configuration3dDeadbandThrottle"></span>
</label>
</div>
</div> </div>
</div> </div>
</div> </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')) {
checkShowSerialRxBox(); case 'rxMode':
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')) {