mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 00:05:22 +03:00
Add new PID elements for version 3.5
- iterm rotation - smart feedforward - iterm relax - absolute control - acro trainer
This commit is contained in:
parent
25b49fb79f
commit
b543ebf3ef
6 changed files with 321 additions and 16 deletions
|
@ -281,6 +281,10 @@
|
|||
width: 33%;
|
||||
}
|
||||
|
||||
.tab-pid_tuning table.compensation tr {
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning table.compensation td {
|
||||
width: 60%;
|
||||
padding-left: 5px;
|
||||
|
@ -289,12 +293,24 @@
|
|||
|
||||
.tab-pid_tuning table.compensation td:first-child {
|
||||
width: 10%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tab-pid_tuning table.compensation td:last-child {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.tab-pid_tuning table.compensation .suboption {
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning table.compensation .suboption select{
|
||||
text-align-last: left;
|
||||
font-size: 1.1em;
|
||||
color: darkslategrey;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .pidTuningFeatures td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
|
|
@ -369,6 +369,13 @@ var FC = {
|
|||
levelSensitivity: 0,
|
||||
itermThrottleThreshold: 0,
|
||||
itermAcceleratorGain: 0,
|
||||
itermRotation: 0,
|
||||
smartFeedforward: 0,
|
||||
itermRelax: 0,
|
||||
itermRelaxType: 0,
|
||||
absoluteControlGain: 0,
|
||||
throttleBoost: 0,
|
||||
acroTrainerAngleLimit: 0,
|
||||
};
|
||||
|
||||
SENSOR_CONFIG = {
|
||||
|
|
|
@ -871,13 +871,25 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
ADVANCED_TUNING.levelAngleLimit = data.readU8();
|
||||
ADVANCED_TUNING.levelSensitivity = data.readU8();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
ADVANCED_TUNING.itermThrottleThreshold = data.readU16();
|
||||
ADVANCED_TUNING.itermAcceleratorGain = data.readU16();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
ADVANCED_TUNING.dtermSetpointWeight = data.readU16();
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
ADVANCED_TUNING.itermThrottleThreshold = data.readU16();
|
||||
ADVANCED_TUNING.itermAcceleratorGain = data.readU16();
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
ADVANCED_TUNING.dtermSetpointWeight = data.readU16();
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||
ADVANCED_TUNING.itermRotation = data.readU8();
|
||||
ADVANCED_TUNING.smartFeedforward = data.readU8();
|
||||
ADVANCED_TUNING.itermRelax = data.readU8();
|
||||
ADVANCED_TUNING.itermRelaxType = data.readU8();
|
||||
ADVANCED_TUNING.absoluteControlGain = data.readU8();
|
||||
ADVANCED_TUNING.throttleBoost = data.readU8();
|
||||
ADVANCED_TUNING.acroTrainerAngleLimit = data.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1515,16 +1527,30 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(ADVANCED_TUNING.itermThrottleGain)
|
||||
.push16(ADVANCED_TUNING.pidMaxVelocity)
|
||||
.push16(ADVANCED_TUNING.pidMaxVelocityYaw);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
buffer.push8(ADVANCED_TUNING.levelAngleLimit)
|
||||
.push8(ADVANCED_TUNING.levelSensitivity);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push16(ADVANCED_TUNING.itermThrottleThreshold)
|
||||
.push16(ADVANCED_TUNING.itermAcceleratorGain);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
buffer.push16(ADVANCED_TUNING.dtermSetpointWeight);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push16(ADVANCED_TUNING.itermThrottleThreshold)
|
||||
.push16(ADVANCED_TUNING.itermAcceleratorGain);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
buffer.push16(ADVANCED_TUNING.dtermSetpointWeight);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||
buffer.push8(ADVANCED_TUNING.itermRotation)
|
||||
.push8(ADVANCED_TUNING.smartFeedforward)
|
||||
.push8(ADVANCED_TUNING.itermRelax)
|
||||
.push8(ADVANCED_TUNING.itermRelaxType)
|
||||
.push8(ADVANCED_TUNING.absoluteControlGain)
|
||||
.push8(ADVANCED_TUNING.throttleBoost)
|
||||
.push8(ADVANCED_TUNING.acroTrainerAngleLimit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// only supports 1 version pre bf 3.0
|
||||
|
|
|
@ -299,6 +299,86 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$('.dtermLowpass2').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||
|
||||
// I Term Rotation
|
||||
$('input[id="itermrotation"]').prop('checked', ADVANCED_TUNING.itermRotation !== 0);
|
||||
|
||||
// Smart Feed Forward
|
||||
$('input[id="smartfeedforward"]').prop('checked', ADVANCED_TUNING.smartFeedforward !== 0);
|
||||
|
||||
// I Term Relax
|
||||
var itermRelaxCheck = $('input[id="itermrelax"]');
|
||||
|
||||
itermRelaxCheck.prop('checked', ADVANCED_TUNING.itermRelax !== 0);
|
||||
$('select[id="itermrelaxAxes"]').val(ADVANCED_TUNING.itermRelax > 0 ? ADVANCED_TUNING.itermRelax : 1);
|
||||
$('select[id="itermrelaxType"]').val(ADVANCED_TUNING.itermRelaxType);
|
||||
|
||||
itermRelaxCheck.change(function() {
|
||||
var checked = $(this).is(':checked');
|
||||
|
||||
if (checked) {
|
||||
$('.itermrelax .suboption').show();
|
||||
} else {
|
||||
$('.itermrelax .suboption').hide();
|
||||
}
|
||||
});
|
||||
itermRelaxCheck.change();
|
||||
|
||||
// Absolute Control
|
||||
var absoluteControlGainNumberElement = $('input[name="absoluteControlGain-number"]');
|
||||
var absoluteControlGainRangeElement = $('input[name="absoluteControlGain-range"]');
|
||||
|
||||
absoluteControlGainNumberElement.change(function () {
|
||||
absoluteControlGainRangeElement.val($(this).val());
|
||||
});
|
||||
absoluteControlGainRangeElement.change(function () {
|
||||
absoluteControlGainNumberElement.val($(this).val());
|
||||
});
|
||||
absoluteControlGainNumberElement.val(ADVANCED_TUNING.absoluteControlGain).change();
|
||||
|
||||
// Throttle Boost
|
||||
var throttleBoostNumberElement = $('input[name="throttleBoost-number"]');
|
||||
var throttleBoostRangeElement = $('input[name="throttleBoost-range"]');
|
||||
|
||||
throttleBoostNumberElement.change(function () {
|
||||
throttleBoostRangeElement.val($(this).val());
|
||||
});
|
||||
throttleBoostRangeElement.change(function () {
|
||||
throttleBoostNumberElement.val($(this).val());
|
||||
});
|
||||
throttleBoostNumberElement.val(ADVANCED_TUNING.throttleBoost).change();
|
||||
|
||||
// Acro Trainer
|
||||
var acroTrainerAngleLimitNumberElement = $('input[name="acroTrainerAngleLimit-number"]');
|
||||
var acroTrainerAngleLimitRangeElement = $('input[name="acroTrainerAngleLimit-range"]');
|
||||
|
||||
var validateAcroTrainerAngle = function(value) {
|
||||
// The minimum acro trainer angle is 10, but we must let zero too to deactivate it
|
||||
if (value > 0 && value < 10) {
|
||||
value = 10;
|
||||
}
|
||||
acroTrainerAngleLimitRangeElement.val(value);
|
||||
acroTrainerAngleLimitNumberElement.val(value);
|
||||
}
|
||||
|
||||
acroTrainerAngleLimitNumberElement.change(function () {
|
||||
validateAcroTrainerAngle($(this).val());
|
||||
});
|
||||
acroTrainerAngleLimitRangeElement.change(function () {
|
||||
validateAcroTrainerAngle($(this).val());
|
||||
});
|
||||
acroTrainerAngleLimitNumberElement.val(ADVANCED_TUNING.acroTrainerAngleLimit).change();
|
||||
|
||||
} else {
|
||||
$('.itermrotation').hide();
|
||||
$('.smartfeedforward').hide();
|
||||
$('.itermrelax').hide();
|
||||
$('.absoluteControlGain').hide();
|
||||
$('.throttleBoost').hide();
|
||||
$('.acroTrainerAngleLimit').hide();
|
||||
}
|
||||
|
||||
$('input[id="gyroNotch1Enabled"]').change(function() {
|
||||
var checked = $(this).is(':checked');
|
||||
var hz = FILTER_CONFIG.gyro_notch_hz > 0 ? FILTER_CONFIG.gyro_notch_hz : DEFAULT.gyro_notch_hz;
|
||||
|
@ -527,6 +607,21 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
FILTER_CONFIG.gyro_lowpass2_type = parseInt($('.pid_filter select[name="gyroLowpass2Type"]').val());
|
||||
FILTER_CONFIG.dterm_lowpass2_hz = parseInt($('.pid_filter input[name="dtermLowpass2Frequency"]').val());
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||
ADVANCED_TUNING.itermRotation = $('input[id="itermrotation"]').is(':checked') ? 1 : 0;
|
||||
ADVANCED_TUNING.smartFeedforward = $('input[id="smartfeedforward"]').is(':checked') ? 1 : 0;
|
||||
|
||||
ADVANCED_TUNING.itermRelax = $('input[id="itermrelax"]').is(':checked') ? $('select[id="itermrelaxAxes"]').val() : 0;
|
||||
ADVANCED_TUNING.itermRelaxType = $('input[id="itermrelax"]').is(':checked') ? $('select[id="itermrelaxType"]').val() : 0;
|
||||
|
||||
ADVANCED_TUNING.absoluteControlGain = $('input[name="absoluteControlGain-number"]').val();
|
||||
|
||||
ADVANCED_TUNING.throttleBoost = $('input[name="throttleBoost-number"]').val();
|
||||
|
||||
ADVANCED_TUNING.acroTrainerAngleLimit = $('input[name="acroTrainerAngleLimit-number"]').val();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showAllPids() {
|
||||
|
|
|
@ -293,7 +293,7 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="dtermSetpoint" style="height:30px;">
|
||||
<tr class="dtermSetpoint">
|
||||
<td><input type="number" name="dtermSetpoint-number" step="0.01" min="0.00" max="20"/></td>
|
||||
<td class="slider"><input type="range" name="dtermSetpoint-range" step="0.01" min="0.00" max="20"/></td>
|
||||
<td>
|
||||
|
@ -322,8 +322,60 @@
|
|||
<span i18n="pidTuningDtermSetpointTransitionWarning"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="acroTrainerAngleLimit">
|
||||
<td><input type="number" name="acroTrainerAngleLimit-number" step="1" min="0" max="80"/></td>
|
||||
<td class="slider"><input type="range" name="acroTrainerAngleLimit-range" step="1" min="0" max="80"/></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label>
|
||||
<span i18n="pidTuningAcroTrainerAngleLimit"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningAcroTrainerAngleLimitHelp"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="throttleBoost">
|
||||
<td><input type="number" name="throttleBoost-number" step="1" min="0" max="100"/></td>
|
||||
<td class="slider"><input type="range" name="throttleBoost-range" step="1" min="0" max="100"/></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label>
|
||||
<span i18n="pidTuningThrottleBoost"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningThrottleBoostHelp"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="absoluteControlGain">
|
||||
<td><input type="number" name="absoluteControlGain-number" step="1" min="0" max="20"/></td>
|
||||
<td class="slider"><input type="range" name="absoluteControlGain-range" step="1" min="0" max="20"/></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label>
|
||||
<span i18n="pidTuningAbsoluteControlGain"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningAbsoluteControlGainHelp"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="itermrotation">
|
||||
<td><input type="checkbox" id="itermrotation" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label for="itermrotation">
|
||||
<span i18n="pidTuningItermRotation"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningItermRotationHelp"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="height:30px;"><input type="checkbox" id="vbatpidcompensation" class="toggle" /></td>
|
||||
<td><input type="checkbox" id="vbatpidcompensation" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label for="vbatpidcompensation">
|
||||
|
@ -333,6 +385,54 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="smartfeedforward">
|
||||
<td><input type="checkbox" id="smartfeedforward" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<label for="smartfeedforward">
|
||||
<span i18n="pidTuningSmartFeedforward"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningSmartFeedforwardHelp"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="itermrelax">
|
||||
<td><input type="checkbox" id="itermrelax" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
<span>
|
||||
<label for="itermrelax">
|
||||
<span i18n="pidTuningItermRelax" />
|
||||
</label>
|
||||
</span>
|
||||
|
||||
<span class="suboption">
|
||||
<label for="itermrelaxAxes">
|
||||
<span i18n="pidTuningItermRelaxAxes" />
|
||||
</label>
|
||||
<select id="itermrelaxAxes">
|
||||
<option i18n="pidTuningItermRelaxAxesOptionRP" value="1">
|
||||
<option i18n="pidTuningItermRelaxAxesOptionRPY" value="2"/>
|
||||
<option i18n="pidTuningItermRelaxAxesOptionRPInc" value="3"/>
|
||||
<option i18n="pidTuningItermRelaxAxesOptionRPYInc" value="4"/>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<span class="suboption">
|
||||
<label for="itermrelaxType">
|
||||
<span i18n="pidTuningItermRelaxType" />
|
||||
</label>
|
||||
<select id="itermrelaxType">
|
||||
<option i18n="pidTuningItermRelaxTypeOptionGyro" value="0"/>
|
||||
<option i18n="pidTuningItermRelaxTypeOptionSetpoint" value="1"/>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningItermRelaxHelp"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue