Merge pull request #386 from mikeller/cleanup_configuration_tab

Cleaned up configuration tab.
10.3.x-maintenance
Michael Keller 2017-01-15 14:18:00 +13:00 committed by GitHub
commit 9cb7de962c
7 changed files with 73 additions and 82 deletions

View File

@ -641,12 +641,6 @@
"configurationDisarmKillSwitch": {
"message": "Disarm motors regardless of throttle value (When arming via AUX channel)"
},
"configurationMidRc": {
"message": "Center value for RC channels"
},
"configurationMidRcHelp": {
"message": "This is the center value <span style=\"font-weight: bold\">for all RC channels</span>. Set this to the value that your transmitter sends when the stick is centered for a channel. To adjust the thrust at throttle mid position, change the 'Trottle MID' value on the PID Tuning tab."
},
"configurationDigitalIdlePercent": {
"message": "Motor Idle Throttle Value (percent)"
},
@ -979,6 +973,12 @@
"receiverThrottleExpo": {
"message": "Throttle EXPO"
},
"receiverMidRc": {
"message": "Center value for RC channels"
},
"receiverMidRcHelp": {
"message": "This is the center value <span style=\"font-weight: bold\">for all RC channels</span>. Set this to the value that your transmitter sends when the stick is centered for a channel. To adjust the thrust at throttle mid position, change the 'Trottle MID' value on the PID Tuning tab."
},
"receiverDeadband": {
"message": "RC Deadband"
},

View File

@ -185,7 +185,6 @@ var FC = {
};
MISC = {
midrc: 0,
minthrottle: 0,
maxthrottle: 0,
mincommand: 0,

View File

@ -205,7 +205,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
}
break;
case MSPCodes.MSP_MISC: // 22 bytes
MISC.midrc = data.readU16();
RX_CONFIG.midrc = data.readU16();
MISC.minthrottle = data.readU16(); // 0-2000
MISC.maxthrottle = data.readU16(); // 0-2000
MISC.mincommand = data.readU16(); // 0-2000
@ -1029,7 +1029,7 @@ MspHelper.prototype.crunch = function(code) {
buffer.push16(FC_CONFIG.loopTime);
break;
case MSPCodes.MSP_SET_MISC:
buffer.push16(MISC.midrc)
buffer.push16(RX_CONFIG.midrc)
.push16(MISC.minthrottle)
.push16(MISC.maxthrottle)
.push16(MISC.mincommand)

View File

@ -82,15 +82,6 @@
</div>
</div>
<!-- -->
<div class="number">
<label>
<div class="numberspacer">
<input type="number" name="midrc" min="0" max="2000" />
</div>
<span i18n="configurationMidRc"></span>
<div class="helpicon cf_tip" i18n_title="configurationMidRcHelp"></div>
</label>
</div>
<div class="number digitalIdlePercent">
<label>
<div class="numberspacer">
@ -361,33 +352,33 @@
<!-- table generated here -->
</tbody>
</table>
<div class="select batterymetertype">
<div class="select batterymetertype vbatmonitoring">
<label>
<select class="batterymetertype"><!-- list generated here --></select>
<span i18n="configurationBatteryMeterType"></span>
</label>
</div>
<div class="number">
<div class="number vbatmonitoring">
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryMinimum"></span>
</label>
</div>
<div class="number">
<div class="number vbatmonitoring">
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryMaximum"></span>
</label>
</div>
<div class="number">
<div class="number vbatmonitoring">
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryWarning"></span>
</label>
</div>
<div class="number">
<div class="number vbatmonitoring vbatCalibration">
<label> <input type="number" name="voltagescale" step="1" min="10" max="255" /> <span
i18n="configurationBatteryScale"></span>
</label>
</div>
<div class="number">
<div class="number vbatmonitoring">
<label> <input type="text" name="batteryvoltage" readonly class="disabled" /> <span
i18n="configurationBatteryVoltage"></span>
</label>
@ -411,29 +402,29 @@
<!-- table generated here -->
</tbody>
</table>
<div class="select">
<div class="select currentMonitoring">
<label>
<select class="currentmetertype"><!-- list generated here --></select>
<span i18n="configurationCurrentMeterType"></span>
</label>
</div>
<div class="number">
<div class="number currentMonitoring currentCalibration">
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
i18n="configurationCurrentScale"></span>
</label>
</div>
<div class="number">
<div class="number currentMonitoring currentCalibration">
<label> <input type="number" name="currentoffset" step="1" min="-1600" max="16000" /> <span
i18n="configurationCurrentOffset"></span>
</label>
</div>
<div class="number">
<div class="number currentMonitoring currentOutput">
<label>
<input type="text" name="batterycurrent" readonly class="disabled" /> <span
i18n="configurationBatteryCurrent"></span>
</label>
</div>
<div class="checkbox">
<div class="checkbox currentMonitoring currentOutput">
<div class="numberspacer">
<input type="checkbox" name="multiwiicurrentoutput" class="toggle" />
</div>

View File

@ -458,7 +458,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
// fill throttle
$('input[name="midrc"]').val(MISC.midrc);
var minThrottle_e = $('input[name="minthrottle"]');
minThrottle_e.val(MISC.minthrottle);
$('input[name="maxthrottle"]').val(MISC.maxthrottle);
@ -497,7 +496,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
batteryMeterType_e.change(function () {
MISC.batterymetertype = parseInt($(this).val());
checkDisableVbatControls();
checkUpdateVbatControls();
});
batteryMeterType_e.val(MISC.batterymetertype).change();
} else {
@ -527,7 +526,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
currentMeterType_e.change(function () {
BF_CONFIG.currentmetertype = parseInt($(this).val());
checkDisableCurrentControls();
checkUpdateCurrentControls();
});
currentMeterType_e.val(BF_CONFIG.currentmetertype).change();
@ -574,54 +573,43 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
}
function checkDisableVbatControls() {
function disableBatteryControls(disabled) {
$('input[name="mincellvoltage"]').prop('disabled', disabled);
$('input[name="maxcellvoltage"]').prop('disabled', disabled);
$('input[name="warningcellvoltage"]').prop('disabled', disabled);
$('input[name="voltagescale"]').prop('disabled', disabled);
}
function checkUpdateVbatControls() {
if (BF_CONFIG.features.isEnabled('VBAT')) {
$('.vbatmonitoring').show();
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
if (BF_CONFIG.features.isEnabled('VBAT')) {
$('select.batterymetertype').prop('disabled', false);
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
$('select.batterymetertype').show();
if (MISC.batterymetertype == 1) {
disableBatteryControls(true);
} else {
disableBatteryControls(false);
}
if (MISC.batterymetertype !== 0) {
$('.vbatCalibration').hide();
}
} else {
$('select.batterymetertype').prop('disabled', true);
disableBatteryControls(true);
$('select.batterymetertype').hide();
}
} else {
if (BF_CONFIG.features.isEnabled('VBAT')) {
disableBatteryControls(false);
} else {
disableBatteryControls(true);
}
$('.vbatmonitoring').hide();
}
}
function checkDisableCurrentControls() {
function checkUpdateCurrentControls() {
if (BF_CONFIG.features.isEnabled('CURRENT_METER')) {
$('select.currentmetertype').prop('disabled', false);
if (BF_CONFIG.currentmetertype == 0 || BF_CONFIG.currentmetertype == 3) {
$('input[name="currentscale"]').prop('disabled', true);
$('input[name="currentoffset"]').prop('disabled', true);
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
} else {
$('input[name="currentscale"]').prop('disabled', false);
$('input[name="currentoffset"]').prop('disabled', false);
$('input[name="multiwiicurrentoutput"]').prop('disabled', false);
$('.currentMonitoring').show();
switch(BF_CONFIG.currentmetertype) {
case 0:
$('.currentCalibration').hide();
$('.currentOutput').hide();
break;
case 3:
$('.currentCalibration').hide();
}
if (BF_CONFIG.currentmetertype !== 1 && BF_CONFIG.currentmetertype !== 2) {
$('.currentCalibration').hide();
}
} else {
$('select.currentmetertype').prop('disabled', true);
$('input[name="currentscale"]').prop('disabled', true);
$('input[name="currentoffset"]').prop('disabled', true);
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
$('.currentMonitoring').hide();
}
}
@ -637,16 +625,16 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
});
$(features_e).filter('tbody.features.batteryVoltage').change(function() {
checkDisableVbatControls();
checkUpdateVbatControls();
});
$(features_e).filter('tbody.features.batteryCurrent').change(function() {
checkDisableCurrentControls();
checkUpdateCurrentControls();
});
checkShowSerialRxBox();
checkDisableVbatControls();
checkDisableCurrentControls();
checkUpdateVbatControls();
checkUpdateCurrentControls();
$("input[id='unsyncedPWMSwitch']").change(function() {
if ($(this).is(':checked')) {
@ -672,7 +660,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
ARMING_CONFIG.disarm_kill_switch = $('input[id="disarmkillswitch"]').is(':checked') ? 1 : 0;
}
MISC.midrc = parseInt($('input[name="midrc"]').val());
MISC.minthrottle = parseInt($('input[name="minthrottle"]').val());
MISC.maxthrottle = parseInt($('input[name="maxthrottle"]').val());
MISC.mincommand = parseInt($('input[name="mincommand"]').val());

View File

@ -35,20 +35,32 @@
<div class="gui_box tunings grey" style="float: right;">
<table class="deadband" width="100%">
<tr>
<th i18n="receiverDeadband"></th>
<th i18n="receiverYawDeadband"></th>
<th i18n="receiverMidRc">
</th>
<th i18n="receiverDeadband">
</th>
<th i18n="receiverYawDeadband">
</th>
</tr>
<tr>
<td>
<div class="cf_tip" i18n_title="receiverHelpDeadband">
<input type="number" name="deadband" step="1" min="0" max="32" />
<div class="numberspacer">
<input type="number" name="midrc" min="1200" max="1700" />
<div class="helpicon cf_tip" i18n_title="receiverMidRcHelp"></div>
</div>
</td>
<td>
<div class="cf_tip" i18n_title="receiverHelpYawDeadband">
<input type="number" name="yaw_deadband" step="1" min="0" max="100" />
<div>
<input type="number" name="deadband" step="1" min="0" max="32" />
<div class="helpicon cf_tip" i18n_title="receiverHelpDeadband"></div>
</div>
</td>
<td>
<div>
<input type="number" name="yaw_deadband" step="1" min="0" max="100" />
<div class="helpicon cf_tip" i18n_title="receiverHelpYawDeadband"></div>
</div>
</td>
</tr>
</table>
</div>

View File

@ -74,6 +74,7 @@ TABS.receiver.initialize = function (callback) {
if (semver.lt(CONFIG.apiVersion, "1.15.0")) {
$('.deadband').hide();
} else {
$('.deadband input[name="midrc"]').val(RX_CONFIG.midrc);
$('.deadband input[name="yaw_deadband"]').val(RC_deadband.yaw_deadband);
$('.deadband input[name="deadband"]').val(RC_deadband.deadband);
@ -236,8 +237,9 @@ TABS.receiver.initialize = function (callback) {
$('a.update').click(function () {
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());
RX_CONFIG.midrc = parseInt($('.deadband input[name="midrc"]').val());
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());
}
// catch rc map