Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/betaflight/betaflight-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Haslinghuis <mark@numloq.nl>2022-08-09 00:10:10 +0300
committerMark Haslinghuis <mark@numloq.nl>2022-09-22 15:49:10 +0300
commitbe2cdbd9f16cc5d6990dc97f131378569f685e21 (patch)
treec60d5e09b1f01590a2afca55b39539571d5b00f4
parenta1449a8c9f9d23a5ce2f7d7eb8018714d1f66e4f (diff)
Move TPA from Rates to PID tuning (UI)
-rw-r--r--src/css/tabs/pid_tuning.less8
-rw-r--r--src/js/msp/MSPHelper.js4
-rw-r--r--src/js/tabs/pid_tuning.js24
-rw-r--r--src/tabs/pid_tuning.html21
4 files changed, 40 insertions, 17 deletions
diff --git a/src/css/tabs/pid_tuning.less b/src/css/tabs/pid_tuning.less
index 9cbb7cd7..4ce3e6a8 100644
--- a/src/css/tabs/pid_tuning.less
+++ b/src/css/tabs/pid_tuning.less
@@ -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;
}
diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js
index 82b00090..20abf3f2 100644
--- a/src/js/msp/MSPHelper.js
+++ b/src/js/msp/MSPHelper.js
@@ -1271,7 +1271,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.ADVANCED_TUNING.thrustLinearization = data.readU8();
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
- FC.ADVANCED_TUNING.tpaRate = data.readU8();
+ FC.ADVANCED_TUNING.tpaRate = parseFloat((data.readU8() / 100).toFixed(2));
FC.ADVANCED_TUNING.tpaBreakpoint = data.readU16();
}
}
@@ -2292,7 +2292,7 @@ MspHelper.prototype.crunch = function(code) {
.push8(FC.ADVANCED_TUNING.thrustLinearization);
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
- buffer.push8(FC.ADVANCED_TUNING.tpaRate);
+ buffer.push8(Math.round(FC.ADVANCED_TUNING.tpaRate * 100));
buffer.push16(FC.ADVANCED_TUNING.tpaBreakpoint);
}
}
diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js
index 3039bd45..a57089cd 100644
--- a/src/js/tabs/pid_tuning.js
+++ b/src/js/tabs/pid_tuning.js
@@ -111,11 +111,11 @@ pid_tuning.initialize = function (callback) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
// Moved tpa to profile
- $('.tpa input[name="tpa"]').val(FC.ADVANCED_TUNING.tpaRate);
- $('.tpa input[name="tpa-breakpoint"]').val(FC.ADVANCED_TUNING.tpaBreakpoint);
+ $('input[id="tpaRate"]').val(FC.ADVANCED_TUNING.tpaRate.toFixed(2));
+ $('input[id="tpaBreakpoint"]').val(FC.ADVANCED_TUNING.tpaBreakpoint);
} else {
- $('.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);
+ $('.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")) {
@@ -1191,11 +1191,11 @@ pid_tuning.initialize = function (callback) {
FC.RC_TUNING.throttle_EXPO = parseFloat($('.throttle input[name="expo"]').val());
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
- FC.ADVANCED_TUNING.tpaRate = parseFloat($('.tpa input[name="tpa"]').val());
- FC.ADVANCED_TUNING.tpaBreakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
+ 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 input[name="tpa"]').val());
- FC.RC_TUNING.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
+ 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());
@@ -1782,7 +1782,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();
@@ -1790,6 +1790,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');
diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html
index e0209bb1..4620c9e9 100644
--- a/src/tabs/pid_tuning.html
+++ b/src/tabs/pid_tuning.html
@@ -813,6 +813,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>
@@ -1022,7 +1037,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>
@@ -1032,8 +1047,8 @@
</thead>
<tbody>
<tr>
- <td class="leftzero"><input type="number" name="tpa" step="1" min="0" max="100" /></td>
- <td class="tpa-breakpoint"><input type="number" name="tpa-breakpoint" step="10" min="750" max="2250" /></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>