Added dterm setpoint weight to PID tab.

Added new PID tuning settings.

Moved controller parameters to bottom, made them hide when not relevant.
10.3.x-maintenance
mikeller 2016-08-03 02:26:06 +12:00 committed by Michael Keller
parent b86d019643
commit e83314c65c
5 changed files with 219 additions and 53 deletions

View File

@ -785,9 +785,36 @@
"pidTuningHideUnusedPids": {
"message": "Hide unused PIDs"
},
"pidTuningNonProfilePidSettings": {
"message": "Profile independent PID Controller Settings"
},
"pidTuningPidSettings": {
"message": "PID Controller Settings"
},
"pidTuningRcSmoothing": {
"message": "RC Smoothing"
},
"pidTuningRcSmoothingOff": {
"message": "Off"
},
"pidTuningRcSmoothingDefault": {
"message": "Default"
},
"pidTuningRcSmoothingAuto": {
"message": "Auto"
},
"pidTuningRcSmoothingManual": {
"message": "Manual"
},
"pidTuningRcSmoothingInterval": {
"message": "RC Smoothing Interval (ms)"
},
"pidTuningPtermSetpoint": {
"message": "Pterm Setpoint Weight"
},
"pidTuningDtermSetpoint": {
"message": "Dterm Setpoint Weight"
},
"pidTuningProportional": {
"message": "Proportional"
},
@ -846,7 +873,7 @@
"message": "Profile"
},
"pidTuningControllerHead": {
"message": "PID"
"message": "PID Controller"
},
"pidTuningResetProfile": {
"message": "Reset all profile values"
@ -1766,7 +1793,16 @@
"pidTuningRateProfileTip": {
"message": "Up to 3 different rateprofiles per profile can be stored on the flight controller. The rateprofiles include the settings for 'RC Rate', 'Rate', 'RC Expo', 'Throttle', and 'TPA'. Switching between rateprofiles is possible in-flight, by setting up a 3 position switch for 'Rate Profile Selection' on the 'Adjustments' tab."
},
"pidTuningPidTip": {
"pidTuningDelta": {
"message": "Derivative Method"
},
"pidTuningDeltaError": {
"message": "Error"
},
"pidTuningDeltaMeasurement": {
"message": "Measurement"
},
"pidTuningDeltaTip": {
"message": "<b>Derivative from Error</b> provides more direct stick response and is mostly prefered for Racing.<br><br><b>Derivative from Measurement</b> provides smoother stick response what is more usefull for freestyling"
},
"pidTuningPidControllerTip": {

View File

@ -911,7 +911,9 @@ var MSP = {
offset += 2;
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
RX_CONFIG.rcSmoothing = data.getUint8(offset, 1);
offset++;
RX_CONFIG.rcSmoothInterval = data.getUint8(offset, 1);
offset++;
RX_CONFIG.airModeActivateThreshold = data.getUint16(offset, 1);
} else {
RX_CONFIG.rcSmoothing = 0;

View File

@ -264,8 +264,25 @@
.tab-pid_tuning .compensation td {
padding: 5px;
}
}
.tab-pid_tuning .compensation td:first-child {
width: 20%;
padding-bottom: 6px;
padding-top: 5px;
}
.tab-pid_tuning .compensation td:last-child {
width: 40%;
}
.tab-pid_tuning .compensation td {
width: 40%;
}
.tab-pid_tuning .compensation .slider input {
-webkit-appearance: slider-horizontal
}
.tab-pid_tuning table td {
padding: 1px;
@ -554,7 +571,7 @@
.tab-pid_tuning .controller {
width: 100px;
width: 150px;
}
.tab-pid_tuning .controller select {
@ -657,4 +674,4 @@ width: 50%;
.tab-pid_tuning .new_rates_last-child {
border-bottom: none;
}
}

View File

@ -41,16 +41,6 @@
</select>
</div>
</div>
<div class="delta single-field">
<div class="helpicon cf_tip" i18n_title="pidTuningPidTip" style="margin-top: 5px;"></div>
<div class="head">Derivative Method</div>
<div class="bottomarea">
<select name="delta">
<option value="0">Error</option>
<option value="1">Measurement</option>
</select>
</div>
</div>
<div class="cf_column right">
<div class="default_btn show">
<a href="#" id="showAllPids" i18n="pidTuningShowAllPids"></a>
@ -64,31 +54,6 @@
<div class="clear-both"></div>
<div class="cf_column twothird">
<div class="gui_box grey">
<table class="pid_titlebar new_rates">
<tr>
<th i18n="pidTuningPidSettings"></th>
</tr>
</table>
<table class="compensation">
<tbody class="features pidTuning">
<!-- table generated here -->
</tbody>
<tr>
<td>
<input type="checkbox" name="vbatpidcompensation" class="toggle" />
</td>
<td colspan=2>
<div>
<label for="vbatpidcompensation">
<span i18n="pidTuningVbatPidCompensation"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningVbatPidCompensationHelp"></div>
</div>
</td>
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
<table class="pid_titlebar">
<tr>
<th class="name" i18n="pidTuningName"></th>
@ -275,6 +240,79 @@
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
<table class="pid_titlebar new_rates">
<tr>
<th i18n="pidTuningNonProfilePidSettings"></th>
</tr>
</table>
<table class="compensation">
<tbody class="features pidTuning">
<!-- table generated here -->
</tbody>
<tr class="rcSmoothing">
<td>
<select name="rcSmoothing-select">
<option value="0" i18n="pidTuningRcSmoothingOff"/>
<option value="1" i18n="pidTuningRcSmoothingDefault"/>
<option value="2" i18n="pidTuningRcSmoothingAuto"/>
<option value="3" i18n="pidTuningRcSmoothingManual"/>
</select>
</td>
<td colspan=2 i18n="pidTuningRcSmoothing"></td>
</tr>
<tr class="rcSmoothingInterval">
<td><input type="number" class="nonProfile" name="rcSmoothingInterval-number" step="1" min="1" max="50"/></td>
<td colspan=2 i18n="pidTuningRcSmoothingInterval"></td>
</td>
</table>
</div>
<div class="gui_box grey topspacer">
<table class="pid_titlebar new_rates">
<tr>
<th i18n="pidTuningPidSettings"></th>
</tr>
</table>
<table class="compensation">
<tr class="delta">
<td>
<select name="delta-select">
<option value="0" i18n="pidTuningDeltaError"/>
<option value="1" i18n="pidTuningDeltaMeasurement"/>
</select>
</td>
<td colspan=2>
<div>
<label for="delta-select">
<span i18n="pidTuningDelta"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDeltaTip"></div>
</div>
</td>
</tr>
<tr class="ptermSetpoint">
<td><input type="number" name="ptermSetpoint-number" step="0.01" min="0.30" max="1.00"/></td>
<td class="slider"><input type="range" name="ptermSetpoint-range" step="0.01" min="0.30" max="1.00"/></td>
<td i18n="pidTuningPtermSetpoint"></td>
</tr>
<tr class="dtermSetpoint">
<td><input type="number" name="dtermSetpoint-number" step="0.01" min="0.00" max="3.00"/></td>
<td class="slider"><input type="range" name="dtermSetpoint-range" step="0.01" min="0.00" max="3.00"/></td>
<td i18n="pidTuningDtermSetpoint"></td>
</tr>
<tr>
<td><input type="checkbox" name="vbatpidcompensation" class="toggle" /></td>
<td colspan=2>
<div>
<label for="vbatpidcompensation">
<span i18n="pidTuningVbatPidCompensation"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningVbatPidCompensationHelp"></div>
</div>
</td>
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
<table class="pid_titlebar">
<thead>
@ -399,4 +437,4 @@
<a class="refresh" href="#" i18n="pidTuningButtonRefresh"></a>
</div>
</div>
</div>
</div>

View File

@ -33,6 +33,10 @@ TABS.pid_tuning.initialize = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
return MSP.promise(MSP_codes.MSP_PID_ADVANCED);
}
}).then(function() {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
return MSP.promise(MSP_codes.MSP_RX_CONFIG);
}
}).then(function() {
return MSP.promise(MSP_codes.MSP_RC_TUNING);
}).then(function() {
@ -59,7 +63,19 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
$('.delta select').val(ADVANCED_TUNING.deltaMethod);
$('#pid-tuning .delta select').val(ADVANCED_TUNING.deltaMethod);
}
if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
$('select[name="rcSmoothing-select"]').val(RX_CONFIG.rcSmoothing);
$('input[name="rcSmoothingInterval-number"]').val(RX_CONFIG.rcSmoothInterval);
$('input[name="ptermSetpoint-number"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);
$('input[name="ptermSetpoint-range"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);
$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
}
// Fill in the data from PIDs array
@ -238,7 +254,17 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
ADVANCED_TUNING.deltaMethod = $('.delta select').val();
ADVANCED_TUNING.deltaMethod = $('#pid-tuning .delta select').val();
}
if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
RX_CONFIG.rcSmoothing = parseInt($('select[name="rcSmoothing-select"]').val());
RX_CONFIG.rcSmoothInterval = parseInt($('input[name="rcSmoothingInterval-number"]').val());
ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100);
ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100);
}
// Fill in the data from PIDs array
@ -504,10 +530,39 @@ TABS.pid_tuning.initialize = function (callback) {
});
});
});
var ptermNumberElement = $('input[name="ptermSetpoint-number"]');
var ptermRangeElement = $('input[name="ptermSetpoint-range"]');
ptermNumberElement.change(function () {
ptermRangeElement.val($(this).val());
});
ptermRangeElement.change(function () {
ptermNumberElement.val($(this).val());
});
var dtermNumberElement = $('input[name="dtermSetpoint-number"]');
var dtermRangeElement = $('input[name="dtermSetpoint-range"]');
dtermNumberElement.change(function () {
dtermRangeElement.val($(this).val());
});
dtermRangeElement.change(function () {
dtermNumberElement.val($(this).val());
});
} else {
$('.tab-pid_tuning .rate_profile').hide();
$('.pid-tuning .rcSmoothing').hide();
$('.pid-tuning .rcSmoothingInterval').hide();
$('.pid-tuning .ptermSetpoint').hide();
$('.pid-tuning .dtermSetpoint').hide();
}
if (!semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
$('#pid-tuning .delta').hide();
$('.tab-pid_tuning .note').hide();
}
$('.pid_tuning tr').each(function(){
for(i = 0; i < PID_names.length; i++) {
if($(this).hasClass(PID_names[i])) {
@ -550,6 +605,8 @@ TABS.pid_tuning.initialize = function (callback) {
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
pidController_e.val(PID.controller);
self.updatePidControllerParameters();
} else {
GUI.log(chrome.i18n.getMessage('pidTuningUpgradeFirmwareToChangePidController', [CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion]));
@ -695,22 +752,24 @@ TABS.pid_tuning.initialize = function (callback) {
});
$('#pid-tuning').find('input').each(function (k, item) {
$(item).change(function () {
self.setDirty(true);
})
if ($(item).attr('class') !== "feature toggle"
&& $(item).attr('class') !== "nonProfile") {
$(item).change(function () {
self.setDirty(true);
});
}
});
pidController_e.change(function () {
self.setDirty(true);
self.updatePidControllerParameters();
});
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
$('.delta select').change(function() {
$('#pid-tuning .delta select').change(function() {
self.setDirty(true);
});
} else {
$('.delta').hide();
$('.note').hide();
}
// update == save.
@ -736,6 +795,10 @@ TABS.pid_tuning.initialize = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
return MSP.promise(MSP_codes.MSP_SET_PID_ADVANCED, MSP.crunch(MSP_codes.MSP_SET_PID_ADVANCED));
}
}).then(function () {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
return MSP.promise(MSP_codes.MSP_SET_RX_CONFIG, MSP.crunch(MSP_codes.MSP_SET_RX_CONFIG));
}
}).then(function () {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
return MSP.promise(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG));
@ -892,8 +955,18 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
}
}
TABS.pid_tuning.setUpdating = function (isUpdating) {
var self = this;
TABS.pid_tuning.updatePidControllerParameters = function () {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
if ($('.tab-pid_tuning select[name="controller"]').val() === '0') {
$('#pid-tuning .delta').show();
self.updating = isUpdating;
$('#pid-tuning .ptermSetpoint').hide();
$('#pid-tuning .dtermSetpoint').hide();
} else {
$('#pid-tuning .ptermSetpoint').show();
$('#pid-tuning .dtermSetpoint').show();
$('#pid-tuning .delta').hide();
}
}
}