Skip to content

Commit 30a8261

Browse files
authored
Merge pull request #267 from mikeller/move_rc_interpolation
Moved RC interpolation settings into receiver tab.
2 parents 8017002 + bd93134 commit 30a8261

File tree

7 files changed

+130
-88
lines changed

7 files changed

+130
-88
lines changed

_locales/en/messages.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -802,28 +802,31 @@
802802
"pidTuningPidSettings": {
803803
"message": "PID Controller Settings"
804804
},
805-
"pidTuningRcInterpolationHelp": {
805+
"receiverRcInterpolation": {
806+
"message": "RC Interpolation"
807+
},
808+
"receiverRcInterpolationHelp": {
806809
"message": "RC TX/RX systems are not as fast as PID loops. That means that PID loop has gaps in the information stream from RC systems. This option enables interpolation of the RC input during the times when no RC frames are received. The option also offers cleaner P and D behaviour as there are no ramps in control input."
807810
},
808-
"pidTuningRcInterpolationIntervalHelp": {
811+
"receiverRcInterpolationIntervalHelp": {
809812
"message": "Interpolation interval for manual RC interpolation mode in milliseconds"
810813
},
811-
"pidTuningRcInterpolation": {
814+
"receiverRcInterpolation": {
812815
"message": "RC Interpolation"
813816
},
814-
"pidTuningRcInterpolationOff": {
817+
"receiverRcInterpolationOff": {
815818
"message": "Off"
816819
},
817-
"pidTuningRcInterpolationDefault": {
820+
"receiverRcInterpolationDefault": {
818821
"message": "Preset"
819822
},
820-
"pidTuningRcInterpolationAuto": {
823+
"receiverRcInterpolationAuto": {
821824
"message": "Auto"
822825
},
823-
"pidTuningRcInterpolationManual": {
826+
"receiverRcInterpolationManual": {
824827
"message": "Manual"
825828
},
826-
"pidTuningRcInterpolationInterval": {
829+
"receiverRcInterpolationInterval": {
827830
"message": "RC Interpolating Interval (ms)"
828831
},
829832
"pidTuningPtermSetpoint": {

tabs/pid_tuning.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,25 +264,25 @@
264264
border-right: 0px solid #ccc;
265265
}
266266

267-
.tab-pid_tuning .compensation td {
267+
.tab-pid_tuning .pidTuningFeatures td {
268268
padding: 5px;
269269
}
270270

271-
.tab-pid_tuning .compensation td:first-child {
271+
.tab-pid_tuning .pidTuningFeatures td:first-child {
272272
width: 20%;
273273
padding-bottom: 6px;
274274
padding-top: 5px;
275275
}
276276

277-
.tab-pid_tuning .compensation td:last-child {
277+
.tab-pid_tuning .pidTuningFeatures td:last-child {
278278
width: 80%;
279279
}
280280

281-
.tab-pid_tuning .compensation td {
281+
.tab-pid_tuning .pidTuningFeatures td {
282282
width: 20%;
283283
}
284284

285-
.tab-pid_tuning .compensation .slider input {
285+
.tab-pid_tuning .pidTuningFeatures .slider input {
286286
-webkit-appearance: slider-horizontal
287287
}
288288

tabs/pid_tuning.html

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -240,45 +240,16 @@
240240
</tr>
241241
</table>
242242
</div>
243-
<div class="gui_box grey topspacer">
243+
<div class="gui_box grey topspacer pidTuningFeatures">
244244
<table class="pid_titlebar new_rates">
245245
<tr>
246246
<th i18n="pidTuningNonProfilePidSettings"></th>
247247
</tr>
248248
</table>
249-
<table class="compensation">
249+
<table class="pidTuningFeatures new_rates">
250250
<tbody class="features pidTuning">
251251
<!-- table generated here -->
252252
</tbody>
253-
<tr class="rcInterpolation">
254-
<td>
255-
<select name="rcInterpolation-select">
256-
<option value="0" i18n="pidTuningRcInterpolationOff"/>
257-
<option value="1" i18n="pidTuningRcInterpolationDefault"/>
258-
<option value="2" i18n="pidTuningRcInterpolationAuto"/>
259-
<option value="3" i18n="pidTuningRcInterpolationManual"/>
260-
</select>
261-
</td>
262-
<td colspan=2>
263-
<div>
264-
<label>
265-
<span i18n="pidTuningRcInterpolation"></span>
266-
</label>
267-
<div class="helpicon cf_tip" i18n_title="pidTuningRcInterpolationHelp"></div>
268-
</div>
269-
</td>
270-
</tr>
271-
<tr class="rcInterpolationInterval">
272-
<td><input type="number" class="nonProfile" name="rcInterpolationInterval-number" step="1" min="1" max="50"/></td>
273-
<td colspan=2>
274-
<div>
275-
<label>
276-
<span i18n="pidTuningRcInterpolationInterval"></span>
277-
</label>
278-
<div class="helpicon cf_tip" i18n_title="pidTuningRcInterpolationIntervalHelp"></div>
279-
</div>
280-
</td>
281-
</tr>
282253
</table>
283254
</div>
284255
<div class="gui_box grey topspacer">

tabs/pid_tuning.js

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ TABS.pid_tuning.initialize = function (callback) {
3333
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
3434
return MSP.promise(MSPCodes.MSP_PID_ADVANCED);
3535
}
36-
}).then(function() {
37-
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
38-
return MSP.promise(MSPCodes.MSP_RX_CONFIG);
39-
}
4036
}).then(function() {
4137
return MSP.promise(MSPCodes.MSP_RC_TUNING);
4238
}).then(function() {
@@ -256,17 +252,11 @@ TABS.pid_tuning.initialize = function (callback) {
256252
$('.pid_filter input[name="dTermNotchFrequency"]').val(FILTER_CONFIG.dterm_notch_hz);
257253
$('.pid_filter input[name="dTermNotchCutoff"]').val(FILTER_CONFIG.dterm_notch_cutoff);
258254

259-
$('select[name="rcInterpolation-select"]').val(RX_CONFIG.rcInterpolation);
260-
261-
$('input[name="rcInterpolationInterval-number"]').val(RX_CONFIG.rcInterpolationInterval);
262-
263255
$('input[name="ptermSetpoint-number"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);
264256
$('input[name="ptermSetpoint-range"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);
265257

266258
$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
267259
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
268-
269-
self.updateRcInterpolationParameters();
270260
} else {
271261
$('.pid_filter .newFilter').hide();
272262
}
@@ -363,9 +353,6 @@ TABS.pid_tuning.initialize = function (callback) {
363353
}
364354

365355
if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
366-
RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val());
367-
RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val());
368-
369356
ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100);
370357
ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100);
371358

@@ -454,7 +441,7 @@ TABS.pid_tuning.initialize = function (callback) {
454441
}
455442

456443
var useLegacyCurve = false;
457-
if (CONFIG.flightControllerIdentifier !== "BTFL" || semver.lt(CONFIG.flightControllerVersion, "2.8.0")) {
444+
if (!semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
458445
useLegacyCurve = true;
459446
}
460447

@@ -476,8 +463,10 @@ TABS.pid_tuning.initialize = function (callback) {
476463
}
477464

478465
function process_html() {
479-
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
466+
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0") && !semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
480467
BF_CONFIG.features.generateElements($('.tab-pid_tuning .features'));
468+
} else {
469+
$('.tab-pid_tuning .pidTuningFeatures').hide();
481470
}
482471

483472
// translate to user-selected language
@@ -604,9 +593,6 @@ TABS.pid_tuning.initialize = function (callback) {
604593
} else {
605594
$('.tab-pid_tuning .rate_profile').hide();
606595

607-
$('#pid-tuning .rcInterpolation').hide();
608-
$('#pid-tuning .rcInterpolationInterval').hide();
609-
610596
$('#pid-tuning .ptermSetpoint').hide();
611597
$('#pid-tuning .dtermSetpoint').hide();
612598
}
@@ -826,12 +812,6 @@ TABS.pid_tuning.initialize = function (callback) {
826812
self.updatePidControllerParameters();
827813
});
828814

829-
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
830-
$('select[name="rcInterpolation-select"]').change(function () {
831-
self.updateRcInterpolationParameters();
832-
});
833-
}
834-
835815
// update == save.
836816
$('a.update').click(function () {
837817
form_to_pid_and_rc();
@@ -855,10 +835,6 @@ TABS.pid_tuning.initialize = function (callback) {
855835
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
856836
return MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED));
857837
}
858-
}).then(function () {
859-
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
860-
return MSP.promise(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG));
861-
}
862838
}).then(function () {
863839
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
864840
return MSP.promise(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG));
@@ -1034,13 +1010,3 @@ TABS.pid_tuning.updatePidControllerParameters = function () {
10341010
}
10351011
}
10361012
}
1037-
1038-
TABS.pid_tuning.updateRcInterpolationParameters = function () {
1039-
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
1040-
if ($('select[name="rcInterpolation-select"]').val() === '3') {
1041-
$('#pid-tuning .rcInterpolationInterval').show();
1042-
} else {
1043-
$('#pid-tuning .rcInterpolationInterval').hide();
1044-
}
1045-
}
1046-
}

tabs/receiver.css

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
float: right;
147147
position: relative;
148148
margin: 0px 0px 20px 0;
149-
width: 100%
149+
width: 100%;
150150
border-top-left-radius: 5px;
151151
border-bottom-left-radius: 5px;
152152
background-color: #DEDEDE;
@@ -304,6 +304,28 @@
304304
width: calc(100% - 10px);
305305
}
306306

307+
.tab-receiver .rcInterpolation td {
308+
padding: 5px;
309+
}
310+
311+
.tab-receiver .rcInterpolation td:first-child {
312+
width: 20%;
313+
padding-bottom: 6px;
314+
padding-top: 5px;
315+
}
316+
317+
.tab-receiver .rcInterpolation td:last-child {
318+
width: 80%;
319+
}
320+
321+
.tab-receiver .rcInterpolation td {
322+
width: 20%;
323+
}
324+
325+
.tab-receiver .rcInterpolation .slider input {
326+
-webkit-appearance: slider-horizontal
327+
}
328+
307329
.tab-receiver .curves {
308330
float: left;
309331
margin-right: 10px;

tabs/receiver.html

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,43 @@
5252
</tr>
5353
</table>
5454
</div>
55-
<div class="gui_box grey topspacer">
55+
<div class="gui_box grey tunings topspacer rcInterpolation">
56+
<table class="rcInterpolation" width="100%">
57+
<tr>
58+
<th colspan=2 i18n="receiverRcInterpolation"></th>
59+
</tr>
60+
<tr class="rcInterpolation">
61+
<td>
62+
<select name="rcInterpolation-select">
63+
<option value="0" i18n="receiverRcInterpolationOff"/>
64+
<option value="1" i18n="receiverRcInterpolationDefault"/>
65+
<option value="2" i18n="receiverRcInterpolationAuto"/>
66+
<option value="3" i18n="receiverRcInterpolationManual"/>
67+
</select>
68+
</td>
69+
<td>
70+
<div>
71+
<label>
72+
<span i18n="receiverRcInterpolation"></span>
73+
</label>
74+
<div class="helpicon cf_tip" i18n_title="receiverRcInterpolationHelp"></div>
75+
</div>
76+
</td>
77+
</tr>
78+
<tr class="rcInterpolationInterval">
79+
<td><input type="number" class="nonProfile" name="rcInterpolationInterval-number" step="1" min="1" max="50"/></td>
80+
<td>
81+
<div>
82+
<label>
83+
<span i18n="receiverRcInterpolationInterval"></span>
84+
</label>
85+
<div class="helpicon cf_tip" i18n_title="receiverRcInterpolationIntervalHelp"></div>
86+
</div>
87+
</td>
88+
</tr>
89+
</table>
90+
</div>
91+
<div class="gui_box grey tunings topspacer">
5692
<table class="pid_titlebar" style="width: 100%;">
5793
<thead>
5894
<tr>

0 commit comments

Comments
 (0)