Skip to content

Commit e07955c

Browse files
authored
Add RC smoothing throttle configuration to UI (#4644)
* Add RC smoothing throttle configuration to UI * Duplicate * Reset to AUTO when value is 0 * Add auto-factor-throttle
1 parent a9a281b commit e07955c

File tree

5 files changed

+161
-27
lines changed

5 files changed

+161
-27
lines changed

locales/en/messages.json

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,23 +2057,34 @@
20572057
"message": "Manual"
20582058
},
20592059
"receiverRcSmoothingAutoFactor": {
2060-
"message": "Auto Factor",
2061-
"description": "Auto Factor parameter for RC smoothing"
2060+
"message": "SetPoint Auto Factor",
2061+
"description": "SetPoint Auto Factor parameter for RC smoothing"
20622062
},
20632063
"receiverRcSmoothingAutoFactorHelp": {
2064-
"message": "Adjusts the Auto factor calculation, 10 is the default factor to delay ratio. Increasing the number will smooth RC inputs more, while also adding delay. This may be useful for unreliable RC connections or for cinematic flying.<br>Be careful with numbers approaching 50, input delay will become noticeable.<br>Use the CLI command rc_smoothing_info while TX and RX are powered to see the automatically calculated RC smoothing cutoffs.",
2065-
"description": "Auto Factor parameter help message"
2064+
"message": "Adjusts the SetPoint Auto factor calculation, 10 is the default factor to delay ratio. Increasing the number will smooth RC inputs more, while also adding delay. This may be useful for unreliable RC connections or for cinematic flying.<br>Be careful with numbers approaching 50, input delay will become noticeable.<br>Use the CLI command rc_smoothing_info while TX and RX are powered to see the automatically calculated RC smoothing cutoffs.",
2065+
"description": "SetPoint Auto Factor parameter help message"
20662066
},
20672067
"receiverRcSmoothingAutoFactorHelp2": {
2068-
"message": "Adjusts auto RC smoothing. 30 is the default. Higher values smooth RC inputs more - e.g. 60 for HD freestyle or 90-120 for cinematic flying. Note: Values over 50 will cause appreciable stick delay. Lower values, eg 20-25, will transfer some of the RC control steps into the motor signals, slightly increasing motor heat, but will reduce RC delay slightly. This may be useful for racing.",
2069-
"description": "Auto Factor parameter help message"
2068+
"message": "Adjusts SetPoint RC smoothing. 30 is the default. Higher values smooth RC inputs more - e.g. 60 for HD freestyle or 90-120 for cinematic flying. Note: Values over 50 will cause appreciable stick delay. Lower values, eg 20-25, will transfer some of the RC control steps into the motor signals, slightly increasing motor heat, but will reduce RC delay slightly. This may be useful for racing.",
2069+
"description": "SetPoint Auto Factor parameter help message"
2070+
},
2071+
"receiverRcSmoothingAutoFactorThrottle": {
2072+
"message": "Throttle Auto Factor",
2073+
"description": "Throttle Auto Factor parameter for RC smoothing"
2074+
},
2075+
"receiverRcSmoothingAutoFactorThrottleHelp": {
2076+
"message": "Adjusts the Throttle factor calculation, 10 is the default factor to delay ratio. Increasing the number will smooth throttle inputs more, while also adding delay. This may be useful for unreliable RC connections or for cinematic flying.<br>Be careful with numbers approaching 50, input delay will become noticeable.<br>Use the CLI command rc_smoothing_info while TX and RX are powered to see the automatically calculated RC smoothing cutoffs.",
2077+
"description": "Throttle Auto Factor parameter help message"
20702078
},
20712079
"receiverRcFeedforwardTypeSelect": {
20722080
"message": "Feedforward Cutoff Type"
20732081
},
20742082
"receiverRcSetpointTypeSelect": {
20752083
"message": "Setpoint Cutoff Type"
20762084
},
2085+
"receiverThrottleTypeSelect": {
2086+
"message": "Throttle Cutoff Type"
2087+
},
20772088
"receiverRcSmoothingInterpolation": {
20782089
"message": "Interpolation"
20792090
},
@@ -2095,9 +2106,18 @@
20952106
"receiverRcSmoothingFeedforwardManual": {
20962107
"message": "Selects whether the feedforward filter cutoff frequency is automatically calculated (recommended) or manually selected by the user. Using \"Manual\" is not recommended for receiver protocols like Crossfire which can change in flight."
20972108
},
2109+
"receiverRcSmoothingThrottleManual": {
2110+
"message": "Selects whether RC smoothing is automatically calculated (recommended) or manually selected by the user. Using \"Manual\" is not recommended for receiver protocols like Crossfire which can change in flight."
2111+
},
2112+
"rcSmoothingThrottleCutoffHelp": {
2113+
"message": "The cutoff frequency in Hz used by the throttle smoothing filter. Using lower values will result in smoother inputs and are more appropriate for slower receiver protocols. Most users should leave this at 0 corresponding to \"Auto\"."
2114+
},
20982115
"receiverRcSmoothingSetpointHz": {
20992116
"message": "Setpoint Cutoff Frequency"
21002117
},
2118+
"receiverRcSmoothingThrottleCutoffHz": {
2119+
"message": "Throttle Cutoff Frequency"
2120+
},
21012121
"receiverRcSmoothingFeedforwardCutoff": {
21022122
"message": "Feedforward Cutoff Frequency"
21032123
},

src/js/fc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,12 @@ const FC = {
627627
fpvCamAngleDegrees: 0,
628628
rcSmoothingType: 0,
629629
rcSmoothingSetpointCutoff: 0,
630+
rcSmoothingThrottleCutoff: 0,
630631
rcSmoothingFeedforwardCutoff: 0,
631632
rcSmoothingInputType: 0,
632633
rcSmoothingDerivativeType: 0,
633634
rcSmoothingAutoFactor: 0,
635+
rcSmoothingAutoFactorThrottle: 0,
634636
usbCdcHidType: 0,
635637
rcSmoothing: 0,
636638
elrsUid: [0, 0, 0, 0, 0, 0],

src/js/msp/MSPHelper.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,13 @@ MspHelper.prototype.process_data = function (dataHandler) {
10481048
data.readU8(); // was FC.RX_CONFIG.rcInterpolationChannels
10491049
data.readU8(); // was FC.RX_CONFIG.rcSmoothingType
10501050
FC.RX_CONFIG.rcSmoothingSetpointCutoff = data.readU8();
1051-
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = data.readU8(); // deprecated in 1.47
1052-
data.readU8(); // was FC.RX_CONFIG.rcSmoothingInputType
1051+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
1052+
FC.RX_CONFIG.rcSmoothingThrottleCutoff = data.readU8();
1053+
FC.RX_CONFIG.rcSmoothingAutoFactorThrottle = data.readU8();
1054+
} else {
1055+
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = data.readU8(); // deprecated in 1.47
1056+
data.readU8(); // was FC.RX_CONFIG.rcSmoothingDerivativeCutoff
1057+
}
10531058
data.readU8(); // was FC.RX_CONFIG.rcSmoothingDerivativeType
10541059
FC.RX_CONFIG.usbCdcHidType = data.readU8();
10551060
FC.RX_CONFIG.rcSmoothingAutoFactor = data.readU8();
@@ -1995,10 +2000,15 @@ MspHelper.prototype.crunch = function (code, modifierCode = undefined) {
19952000
.push8(FC.RX_CONFIG.fpvCamAngleDegrees)
19962001
.push8(FC.RX_CONFIG.rcInterpolationChannels)
19972002
.push8(FC.RX_CONFIG.rcSmoothingType)
1998-
.push8(FC.RX_CONFIG.rcSmoothingSetpointCutoff)
1999-
.push8(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff) // deprecated in 1.47
2000-
.push8(FC.RX_CONFIG.rcSmoothingInputType)
2001-
.push8(FC.RX_CONFIG.rcSmoothingDerivativeType);
2003+
.push8(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
2004+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
2005+
buffer.push8(FC.RX_CONFIG.rcSmoothingThrottleCutoff);
2006+
buffer.push8(FC.RX_CONFIG.rcSmoothingAutoFactorThrottle);
2007+
} else {
2008+
buffer.push8(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
2009+
buffer.push8(FC.RX_CONFIG.rcSmoothingInputType);
2010+
}
2011+
buffer.push8(FC.RX_CONFIG.rcSmoothingDerivativeType);
20022012

20032013
// Introduced in 1.42
20042014
buffer.push8(FC.RX_CONFIG.usbCdcHidType).push8(FC.RX_CONFIG.rcSmoothingAutoFactor);

src/js/tabs/receiver.js

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,21 @@ receiver.initialize = function (callback) {
485485

486486
FC.RX_CONFIG.rcSmoothingSetpointCutoff = parseInt($('input[name="rcSmoothingSetpointHz-number"]').val());
487487

488-
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
488+
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
489+
$('select[name="rcSmoothing-setpoint-manual-select"]').val(0).trigger("change");
490+
}
491+
492+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
493+
FC.RX_CONFIG.rcSmoothingThrottleCutoff = Number.parseInt(
494+
$('input[name="rcSmoothingThrottleCutoffHz-number"]').val(),
495+
);
496+
if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
497+
$('select[name="rcSmoothing-throttle-manual-select"]').val(0).trigger("change");
498+
}
499+
FC.RX_CONFIG.rcSmoothingAutoFactorThrottle = Number.parseInt(
500+
$('input[name="rcSmoothingAutoFactorThrottle-number"]').val(),
501+
);
502+
} else {
489503
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = parseInt(
490504
$('input[name="rcSmoothingFeedforwardCutoff-number"]').val(),
491505
);
@@ -649,7 +663,29 @@ receiver.initialize = function (callback) {
649663

650664
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
651665
$(".tab-receiver .rcSmoothing-feedforward-manual").hide();
666+
667+
const rcSmoothingThrottleNumberElement = $('input[name="rcSmoothingThrottleCutoffHz-number"]');
668+
rcSmoothingThrottleNumberElement.val(FC.RX_CONFIG.rcSmoothingThrottleCutoff);
669+
670+
$('select[name="rcSmoothing-throttle-manual-select"]').val("1");
671+
if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
672+
$('select[name="rcSmoothing-throttle-manual-select"]').val("0");
673+
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
674+
}
675+
$('select[name="rcSmoothing-throttle-manual-select"]')
676+
.on("change", function () {
677+
if ($(this).val() === "0") {
678+
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
679+
rcSmoothingThrottleNumberElement.val(0);
680+
}
681+
if ($(this).val() === "1") {
682+
$(".tab-receiver .rcSmoothing-throttle-cutoff").show();
683+
rcSmoothingThrottleNumberElement.val(FC.RX_CONFIG.rcSmoothingThrottleCutoff);
684+
}
685+
})
686+
.trigger("change");
652687
} else {
688+
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
653689
const rcSmoothingFeedforwardNumberElement = $('input[name="rcSmoothingFeedforwardCutoff-number"]');
654690

655691
rcSmoothingFeedforwardNumberElement.val(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
@@ -692,6 +728,12 @@ receiver.initialize = function (callback) {
692728

693729
$(".receiverRcSmoothingAutoFactorHelp").attr("title", i18n.getMessage("receiverRcSmoothingAutoFactorHelp2"));
694730

731+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
732+
$('input[name="rcSmoothingAutoFactorThrottle-number"]').val(FC.RX_CONFIG.rcSmoothingAutoFactorThrottle);
733+
} else {
734+
$(".tab-receiver .rcSmoothing-auto-factor-throttle").hide();
735+
}
736+
695737
updateInterpolationView();
696738

697739
// Only show the MSP control sticks if the MSP Rx feature is enabled
@@ -954,14 +996,19 @@ function updateInterpolationView() {
954996
$(".tab-receiver .rcSmoothing-feedforward-cutoff").show();
955997
$(".tab-receiver .rcSmoothing-setpoint-cutoff").show();
956998

957-
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
999+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
1000+
$(".tab-receiver .rcSmoothing-throttle-manual").show();
1001+
} else {
9581002
$(".tab-receiver .rcSmoothing-feedforward-manual").show();
9591003
}
9601004

9611005
$(".tab-receiver .rcSmoothing-setpoint-manual").show();
9621006

9631007
if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0 || FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
9641008
$(".tab-receiver .rcSmoothing-auto-factor").show();
1009+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
1010+
$(".tab-receiver .rcSmoothing-auto-factor-throttle").show();
1011+
}
9651012
}
9661013

9671014
$(".tab-receiver .rcSmoothingOff").text(i18n.getMessage("off"));
@@ -970,9 +1017,12 @@ function updateInterpolationView() {
9701017
if (FC.RX_CONFIG.rcSmoothing === 0) {
9711018
$(".tab-receiver .rcSmoothing-feedforward-cutoff").hide();
9721019
$(".tab-receiver .rcSmoothing-setpoint-cutoff").hide();
1020+
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
9731021
$(".tab-receiver .rcSmoothing-feedforward-manual").hide();
9741022
$(".tab-receiver .rcSmoothing-setpoint-manual").hide();
1023+
$(".tab-receiver .rcSmoothing-throttle-manual").hide();
9751024
$(".tab-receiver .rcSmoothing-auto-factor").hide();
1025+
$(".tab-receiver .rcSmoothing-auto-factor-throttle").hide();
9761026
}
9771027

9781028
if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0) {
@@ -982,6 +1032,10 @@ function updateInterpolationView() {
9821032
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
9831033
$(".tab-receiver .rcSmoothing-setpoint-cutoff").hide();
9841034
}
1035+
1036+
if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
1037+
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
1038+
}
9851039
}
9861040

9871041
TABS.receiver = receiver;

src/tabs/receiver.html

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,48 +226,96 @@
226226
</div>
227227
</td>
228228
</tr>
229-
<tr class="rcSmoothing-feedforward-manual">
229+
230+
<tr class="rcSmoothing-auto-factor">
230231
<td>
231-
<select name="rcSmoothing-feedforward-select">
232+
<input type="number" name="rcSmoothingAutoFactor-number" step="1" min="0" max="250">
233+
</td>
234+
<td>
235+
<div>
236+
<label>
237+
<span i18n="receiverRcSmoothingAutoFactor"></span>
238+
</label>
239+
</div>
240+
</td>
241+
<td>
242+
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorHelp" i18n_title="receiverRcSmoothingAutoFactorHelp"></div>
243+
</td>
244+
</tr>
245+
246+
<tr class="rcSmoothing-throttle-manual">
247+
<td>
248+
<select name="rcSmoothing-throttle-manual-select">
232249
<option value="0" i18n="receiverRcSmoothingAuto"></option>
233250
<option value="1" i18n="receiverRcSmoothingManual"></option>
234251
</select>
235252
</td>
236253
<td>
237254
<div>
238255
<label>
239-
<span i18n="receiverRcFeedforwardTypeSelect"></span>
256+
<span i18n="receiverThrottleTypeSelect"></span>
240257
</label>
241258
</div>
242259
</td>
243260
<td>
244-
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingFeedforwardManual"></div>
261+
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingThrottleManual"></div>
245262
</td>
246263
</tr>
247-
<tr class="rcSmoothing-feedforward-manual">
248-
<td class="rcSmoothing-feedforward-cutoff"><input type="number" name="rcSmoothingFeedforwardCutoff-number" step="1" min="1" max="255"/></td>
249-
<td colspan="2" class="rcSmoothing-feedforward-cutoff">
264+
<tr class="rcSmoothing-throttle-manual">
265+
<td class="rcSmoothing-throttle-cutoff"><input type="number" name="rcSmoothingThrottleCutoffHz-number" step="1" min="0" max="255"/></td>
266+
<td class="rcSmoothing-throttle-cutoff" colspan="2">
250267
<div>
251268
<label>
252-
<span i18n="receiverRcSmoothingFeedforwardCutoff"></span>
269+
<span i18n="receiverRcSmoothingThrottleCutoffHz"></span>
253270
</label>
254-
<div class="helpicon cf_tip" i18n_title="rcSmoothingFeedforwardCutoffHelp"></div>
271+
<div class="helpicon cf_tip" i18n_title="rcSmoothingThrottleCutoffHelp"></div>
255272
</div>
256273
</td>
257274
</tr>
258-
<tr class="rcSmoothing-auto-factor">
275+
276+
<tr class="rcSmoothing-auto-factor-throttle">
259277
<td>
260-
<input type="number" name="rcSmoothingAutoFactor-number" step="1" min="0" max="250">
278+
<input type="number" name="rcSmoothingAutoFactorThrottle-number" step="1" min="0" max="250">
261279
</td>
262280
<td>
263281
<div>
264282
<label>
265-
<span i18n="receiverRcSmoothingAutoFactor"></span>
283+
<span i18n="receiverRcSmoothingAutoFactorThrottle"></span>
266284
</label>
267285
</div>
268286
</td>
269287
<td>
270-
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorHelp" i18n_title="receiverRcSmoothingAutoFactorHelp"></div>
288+
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorThrottleHelp" i18n_title="receiverRcSmoothingAutoFactorThrottleHelp"></div>
289+
</td>
290+
</tr>
291+
292+
<tr class="rcSmoothing-feedforward-manual">
293+
<td>
294+
<select name="rcSmoothing-feedforward-select">
295+
<option value="0" i18n="receiverRcSmoothingAuto"></option>
296+
<option value="1" i18n="receiverRcSmoothingManual"></option>
297+
</select>
298+
</td>
299+
<td>
300+
<div>
301+
<label>
302+
<span i18n="receiverRcFeedforwardTypeSelect"></span>
303+
</label>
304+
</div>
305+
</td>
306+
<td>
307+
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingFeedforwardManual"></div>
308+
</td>
309+
</tr>
310+
<tr class="rcSmoothing-feedforward-manual">
311+
<td class="rcSmoothing-feedforward-cutoff"><input type="number" name="rcSmoothingFeedforwardCutoff-number" step="1" min="1" max="255"/></td>
312+
<td colspan="2" class="rcSmoothing-feedforward-cutoff">
313+
<div>
314+
<label>
315+
<span i18n="receiverRcSmoothingFeedforwardCutoff"></span>
316+
</label>
317+
<div class="helpicon cf_tip" i18n_title="rcSmoothingFeedforwardCutoffHelp"></div>
318+
</div>
271319
</td>
272320
</tr>
273321
</table>

0 commit comments

Comments
 (0)