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

10.3.x-maintenance
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: 10, group: 'other', name: 'TELEMETRY'},
{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: 14, group: 'rxMode', mode: 'select', name: 'RX_MSP'},
{bit: 15, group: 'rssi', name: 'RSSI_ADC'},

View File

@ -435,11 +435,6 @@
<div class="spacer_box_title" i18n="configurationGPS"></div>
</div>
<div class="spacer_box">
<div class="note">
<div class="note_spacer">
<p i18n="configurationGPSHelp"></p>
</div>
</div>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
@ -452,28 +447,37 @@
<!-- table generated here -->
</tbody>
</table>
<div class="line">
<select class="gps_protocol">
<!-- list generated here -->
</select>
<span i18n="configurationGPSProtocol"></span>
</div>
<div class="line">
<select class="gps_baudrate">
<!-- list generated here -->
</select>
<span i18n="configurationGPSBaudrate"></span>
</div>
<div class="line">
<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 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">
<select class="gps_protocol">
<!-- list generated here -->
</select>
<span i18n="configurationGPSProtocol"></span>
</div>
<div class="line">
<select class="gps_baudrate">
<!-- list generated here -->
</select>
<span i18n="configurationGPSBaudrate"></span>
</div>
<div class="line">
<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>
@ -482,25 +486,39 @@
<div class="spacer_box_title" i18n="configuration3d"></div>
</div>
<div class="spacer_box">
<div class="number">
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
i18n="configuration3dDeadbandLow"></span>
</label>
</div>
<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>
<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">
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
i18n="configuration3dDeadbandLow"></span>
</label>
</div>
<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>

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() {
if (BF_CONFIG.features.isEnabled('RX_SERIAL')) {
$('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 () {
var element = $(this);
BF_CONFIG.features.updateData(element);
updateTabList(BF_CONFIG.features);
if (element.attr('name') === 'rxMode') {
checkShowSerialRxBox();
switch (element.attr('name')) {
case 'rxMode':
checkShowSerialRxBox();
break;
default:
break;
}
});
$(features_e).filter('tbody.features.batteryVoltage').change(function() {
checkUpdateVbatControls();
});
$(features_e).filter('tbody.features.batteryCurrent').change(function() {
checkUpdateCurrentControls();
});
checkShowDisarmDelay();
checkShowSerialRxBox();
checkUpdateVbatControls();
checkUpdateCurrentControls();
checkUpdateGpsControls();
checkUpdate3dControls();
$("input[id='unsyncedPWMSwitch']").change(function() {
if ($(this).is(':checked')) {