Skip to content

Commit 23d50ca

Browse files
authored
Add iterm relax cutoff to UI (#1564)
Add iterm relax cutoff to UI
2 parents ca53342 + 1a96d2d commit 23d50ca

File tree

6 files changed

+33
-2
lines changed

6 files changed

+33
-2
lines changed

locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,6 +3207,9 @@
32073207
"pidTuningItermRelaxTypeOptionSetpoint": {
32083208
"message": "Setpoint"
32093209
},
3210+
"pidTuningItermRelaxCutoff": {
3211+
"message": "Cutoff:"
3212+
},
32103213
"pidTuningAbsoluteControlGain": {
32113214
"message": "Absolute Control"
32123215
},

src/css/tabs/pid_tuning.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@
298298
}
299299

300300
.tab-pid_tuning table.compensation .suboption {
301-
margin-left: 40px;
301+
margin-left: 4%;
302+
white-space: nowrap;
302303
}
303304

304305
.tab-pid_tuning table.compensation .suboption select{
@@ -308,6 +309,12 @@
308309
padding-left: 5px;
309310
}
310311

312+
.tab-pid_tuning table.compensation .suboption input{
313+
display: inline-block;
314+
width: 45px;
315+
padding-left: 5px;
316+
}
317+
311318
.tab-pid_tuning .pidTuningFeatures td {
312319
padding: 5px;
313320
}
@@ -515,7 +522,7 @@
515522
}
516523

517524

518-
.tab-pid_tuing .pid_titlebar td:first-child {
525+
.tab-pid_tuning .pid_titlebar td:first-child {
519526
text-align: left;
520527
}
521528

src/js/fc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ var FC = {
400400
smartFeedforward: 0,
401401
itermRelax: 0,
402402
itermRelaxType: 0,
403+
itermRelaxCutoff: 0,
403404
absoluteControlGain: 0,
404405
throttleBoost: 0,
405406
acroTrainerAngleLimit: 0,

src/js/msp/MSPHelper.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
10441044
ADVANCED_TUNING.dMinAdvance = data.readU8();
10451045
ADVANCED_TUNING.useIntegratedYaw = data.readU8();
10461046
ADVANCED_TUNING.integratedYawRelax = data.readU8();
1047+
1048+
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
1049+
ADVANCED_TUNING.itermRelaxCutoff = data.readU8();
1050+
}
10471051
}
10481052
}
10491053
}
@@ -1798,6 +1802,10 @@ MspHelper.prototype.crunch = function(code) {
17981802
.push8(ADVANCED_TUNING.dMinAdvance)
17991803
.push8(ADVANCED_TUNING.useIntegratedYaw)
18001804
.push8(ADVANCED_TUNING.integratedYawRelax);
1805+
1806+
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
1807+
buffer.push8(ADVANCED_TUNING.itermRelaxCutoff);
1808+
}
18011809
}
18021810
}
18031811
}

src/js/tabs/pid_tuning.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ TABS.pid_tuning.initialize = function (callback) {
203203
itermRelaxCheck.prop('checked', ADVANCED_TUNING.itermRelax !== 0);
204204
$('select[id="itermrelaxAxes"]').val(ADVANCED_TUNING.itermRelax > 0 ? ADVANCED_TUNING.itermRelax : 1);
205205
$('select[id="itermrelaxType"]').val(ADVANCED_TUNING.itermRelaxType);
206+
$('input[name="itermRelaxCutoff"]').val(ADVANCED_TUNING.itermRelaxCutoff);
206207

207208
itermRelaxCheck.change(function() {
208209
var checked = $(this).is(':checked');
@@ -350,6 +351,9 @@ TABS.pid_tuning.initialize = function (callback) {
350351

351352
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
352353
$('.smartfeedforward').hide();
354+
$('.itermRelaxCutoff').show();
355+
} else {
356+
$('.itermRelaxCutoff').hide();
353357
}
354358

355359
$('input[id="useIntegratedYaw"]').change(function() {
@@ -638,6 +642,7 @@ TABS.pid_tuning.initialize = function (callback) {
638642

639643
ADVANCED_TUNING.itermRelax = $('input[id="itermrelax"]').is(':checked') ? $('select[id="itermrelaxAxes"]').val() : 0;
640644
ADVANCED_TUNING.itermRelaxType = $('input[id="itermrelax"]').is(':checked') ? $('select[id="itermrelaxType"]').val() : 0;
645+
ADVANCED_TUNING.itermRelaxCutoff = parseInt($('input[name="itermRelaxCutoff"]').val());
641646

642647
ADVANCED_TUNING.absoluteControlGain = $('input[name="absoluteControlGain-number"]').val();
643648

src/tabs/pid_tuning.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,13 @@
488488
</select>
489489
</span>
490490

491+
<span class="itermRelaxCutoff suboption">
492+
<label for="itermRelaxCutoff">
493+
<span i18n="pidTuningItermRelaxCutoff" />
494+
</label>
495+
<input type="number" name="itermRelaxCutoff" step="1" min="1" max="100" />
496+
</span>
497+
491498
<div class="helpicon cf_tip" i18n_title="pidTuningItermRelaxHelp"></div>
492499
</td>
493500
</tr>

0 commit comments

Comments
 (0)