mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 16:55:24 +03:00
Merge pull request #2988 from haslinghuis/update-pidprofile
Move TPA to PID profile
This commit is contained in:
commit
2d84e4738e
5 changed files with 86 additions and 24 deletions
|
@ -287,6 +287,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
table.tpa-settings {
|
||||
tr {
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
.pidTuningFeatures {
|
||||
td {
|
||||
padding: 5px;
|
||||
|
@ -458,9 +463,6 @@
|
|||
float: left;
|
||||
width: 25%;
|
||||
}
|
||||
.leftzero {
|
||||
padding-left: 0;
|
||||
}
|
||||
.roll {
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
|
|
@ -229,10 +229,10 @@ const FC = {
|
|||
roll_rate: 0,
|
||||
pitch_rate: 0,
|
||||
yaw_rate: 0,
|
||||
dynamic_THR_PID: 0,
|
||||
dynamic_THR_PID: 0, // moved in 1.45 to ADVANCED_TUNING
|
||||
throttle_MID: 0,
|
||||
throttle_EXPO: 0,
|
||||
dynamic_THR_breakpoint: 0,
|
||||
dynamic_THR_breakpoint: 0, // moved in 1.45 to ADVANCED_TUNING
|
||||
RC_YAW_EXPO: 0,
|
||||
rcYawRate: 0,
|
||||
rcPitchRate: 0,
|
||||
|
@ -518,6 +518,8 @@ const FC = {
|
|||
feedforward_jitter_factor: 0,
|
||||
vbat_sag_compensation: 0,
|
||||
thrustLinearization: 0,
|
||||
tpaRate: 0,
|
||||
tpaBreakpoint: 0,
|
||||
};
|
||||
this.ADVANCED_TUNING_ACTIVE = { ...this.ADVANCED_TUNING };
|
||||
|
||||
|
|
|
@ -406,11 +406,19 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FC.RC_TUNING.pitch_rate = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
}
|
||||
FC.RC_TUNING.yaw_rate = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
FC.RC_TUNING.dynamic_THR_PID = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.RC_TUNING.dynamic_THR_PID = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
} else {
|
||||
data.readU8();
|
||||
}
|
||||
FC.RC_TUNING.throttle_MID = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
FC.RC_TUNING.throttle_EXPO = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.7.0")) {
|
||||
FC.RC_TUNING.dynamic_THR_breakpoint = data.readU16();
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.RC_TUNING.dynamic_THR_breakpoint = data.readU16();
|
||||
} else {
|
||||
data.readU16();
|
||||
}
|
||||
} else {
|
||||
FC.RC_TUNING.dynamic_THR_breakpoint = 0;
|
||||
}
|
||||
|
@ -1245,15 +1253,15 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FC.ADVANCED_TUNING.useIntegratedYaw = data.readU8();
|
||||
FC.ADVANCED_TUNING.integratedYawRelax = data.readU8();
|
||||
|
||||
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
FC.ADVANCED_TUNING.itermRelaxCutoff = data.readU8();
|
||||
|
||||
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
FC.ADVANCED_TUNING.motorOutputLimit = data.readU8();
|
||||
FC.ADVANCED_TUNING.autoProfileCellCount = data.read8();
|
||||
FC.ADVANCED_TUNING.idleMinRpm = data.readU8();
|
||||
|
||||
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
FC.ADVANCED_TUNING.feedforward_averaging = data.readU8();
|
||||
FC.ADVANCED_TUNING.feedforward_smooth_factor = data.readU8();
|
||||
FC.ADVANCED_TUNING.feedforward_boost = data.readU8();
|
||||
|
@ -1261,6 +1269,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FC.ADVANCED_TUNING.feedforward_jitter_factor = data.readU8();
|
||||
FC.ADVANCED_TUNING.vbat_sag_compensation = data.readU8();
|
||||
FC.ADVANCED_TUNING.thrustLinearization = data.readU8();
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.ADVANCED_TUNING.tpaRate = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
FC.ADVANCED_TUNING.tpaBreakpoint = data.readU16();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1830,12 +1843,20 @@ MspHelper.prototype.crunch = function(code) {
|
|||
buffer.push8(Math.round(FC.RC_TUNING.roll_rate * 100))
|
||||
.push8(Math.round(FC.RC_TUNING.pitch_rate * 100));
|
||||
}
|
||||
buffer.push8(Math.round(FC.RC_TUNING.yaw_rate * 100))
|
||||
.push8(Math.round(FC.RC_TUNING.dynamic_THR_PID * 100))
|
||||
.push8(Math.round(FC.RC_TUNING.throttle_MID * 100))
|
||||
.push8(Math.round(FC.RC_TUNING.throttle_EXPO * 100));
|
||||
buffer.push8(Math.round(FC.RC_TUNING.yaw_rate * 100));
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
buffer.push8(Math.round(FC.RC_TUNING.dynamic_THR_PID * 100));
|
||||
} else {
|
||||
buffer.push8(0);
|
||||
}
|
||||
buffer.push8(Math.round(FC.RC_TUNING.throttle_MID * 100));
|
||||
buffer.push8(Math.round(FC.RC_TUNING.throttle_EXPO * 100));
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.7.0")) {
|
||||
buffer.push16(FC.RC_TUNING.dynamic_THR_breakpoint);
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
buffer.push16(FC.RC_TUNING.dynamic_THR_breakpoint);
|
||||
} else {
|
||||
buffer.push16(0);
|
||||
}
|
||||
}
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.10.0")) {
|
||||
buffer.push8(Math.round(FC.RC_TUNING.RC_YAW_EXPO * 100));
|
||||
|
@ -2269,6 +2290,11 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(FC.ADVANCED_TUNING.feedforward_jitter_factor)
|
||||
.push8(FC.ADVANCED_TUNING.vbat_sag_compensation)
|
||||
.push8(FC.ADVANCED_TUNING.thrustLinearization);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
buffer.push8(Math.round(FC.ADVANCED_TUNING.tpaRate * 100));
|
||||
buffer.push16(FC.ADVANCED_TUNING.tpaBreakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,8 +109,14 @@ pid_tuning.initialize = function (callback) {
|
|||
$('.throttle input[name="mid"]').val(FC.RC_TUNING.throttle_MID.toFixed(2));
|
||||
$('.throttle input[name="expo"]').val(FC.RC_TUNING.throttle_EXPO.toFixed(2));
|
||||
|
||||
$('.tpa input[name="tpa"]').val(FC.RC_TUNING.dynamic_THR_PID.toFixed(2));
|
||||
$('.tpa input[name="tpa-breakpoint"]').val(FC.RC_TUNING.dynamic_THR_breakpoint);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
// Moved tpa to profile
|
||||
$('input[id="tpaRate"]').val(FC.ADVANCED_TUNING.tpaRate.toFixed(2));
|
||||
$('input[id="tpaBreakpoint"]').val(FC.ADVANCED_TUNING.tpaBreakpoint);
|
||||
} else {
|
||||
$('.tpa-old input[name="tpa"]').val(FC.RC_TUNING.dynamic_THR_PID.toFixed(2));
|
||||
$('.tpa-old input[name="tpa-breakpoint"]').val(FC.RC_TUNING.dynamic_THR_breakpoint);
|
||||
}
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, "1.10.0")) {
|
||||
$('.pid_tuning input[name="rc_yaw_expo"]').hide();
|
||||
|
@ -1179,8 +1185,14 @@ pid_tuning.initialize = function (callback) {
|
|||
FC.RC_TUNING.throttle_MID = parseFloat($('.throttle input[name="mid"]').val());
|
||||
FC.RC_TUNING.throttle_EXPO = parseFloat($('.throttle input[name="expo"]').val());
|
||||
|
||||
FC.RC_TUNING.dynamic_THR_PID = parseFloat($('.tpa input[name="tpa"]').val());
|
||||
FC.RC_TUNING.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.ADVANCED_TUNING.tpaRate = parseFloat($('input[id="tpaRate"]').val());
|
||||
FC.ADVANCED_TUNING.tpaBreakpoint = parseInt($('input[id="tpaBreakpoint"]').val());
|
||||
} else {
|
||||
FC.RC_TUNING.dynamic_THR_PID = parseFloat($('.tpa-old input[name="tpa"]').val());
|
||||
FC.RC_TUNING.dynamic_THR_breakpoint = parseInt($('.tpa-old input[name="tpa-breakpoint"]').val());
|
||||
}
|
||||
|
||||
FC.FILTER_CONFIG.gyro_lowpass_hz = parseInt($('.pid_filter input[name="gyroLowpassFrequency"]').val());
|
||||
FC.FILTER_CONFIG.dterm_lowpass_hz = parseInt($('.pid_filter input[name="dtermLowpassFrequency"]').val());
|
||||
FC.FILTER_CONFIG.yaw_lowpass_hz = parseInt($('.pid_filter input[name="yawLowpassFrequency"]').val());
|
||||
|
@ -1765,7 +1777,7 @@ pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, "1.7.0")) {
|
||||
$('.tpa .tpa-breakpoint').hide();
|
||||
$('.tpa-old .tpa-breakpoint').hide();
|
||||
|
||||
$('.pid_tuning .roll_rate').hide();
|
||||
$('.pid_tuning .pitch_rate').hide();
|
||||
|
@ -1773,6 +1785,12 @@ pid_tuning.initialize = function (callback) {
|
|||
$('.pid_tuning .roll_pitch_rate').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
$('.tpa-old').hide();
|
||||
} else {
|
||||
$('.tpa').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)) {
|
||||
$('.pid_tuning .bracket').hide();
|
||||
$('.pid_tuning input[name=rc_rate]').parent().attr('class', 'pid_data');
|
||||
|
|
|
@ -814,6 +814,21 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="gui_box grey tpa pidControllerAdvancedSettings spacer_left">
|
||||
<table class="pid_titlebar tpa-header" aria-labelledby="tpa-header">
|
||||
<tr>
|
||||
<th i18n="pidTuningTPA"></th>
|
||||
<th i18n="pidTuningTPABreakPoint"></th>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="tpa-settings" aria-labelledby="tpa-settings" role="presentation">
|
||||
<tr>
|
||||
<td><input type="number" id="tpaRate" step="0.01" min="0" max="1.00" /></td>
|
||||
<td class="tpa-breakpoint"><input type="number" id="tpaBreakpoint" step="10" min="750" max="2250" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="gui_box grey pidControllerAdvancedSettings spacer_left">
|
||||
<table class="pid_titlebar new_rates">
|
||||
<tr>
|
||||
|
@ -1023,7 +1038,7 @@
|
|||
</div>
|
||||
|
||||
<div class="cf_column">
|
||||
<div class="gui_box tpa spacer_left">
|
||||
<div class="gui_box tpa-old spacer_left">
|
||||
<table class="cf">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -1033,9 +1048,8 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="leftzero"><input type="number" name="tpa" step="0.01" min="0"
|
||||
max="1.00" /></td>
|
||||
<td class="tpa-breakpoint"><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
|
||||
<td class="tpaRate"><input type="number" name="tpa" step="0.01" min="0" max="1.00" /></td>
|
||||
<td class="tpaBreakpoint"><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue