Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2057,23 +2057,34 @@
"message": "Manual"
},
"receiverRcSmoothingAutoFactor": {
"message": "Auto Factor",
"description": "Auto Factor parameter for RC smoothing"
"message": "SetPoint Auto Factor",
"description": "SetPoint Auto Factor parameter for RC smoothing"
},
"receiverRcSmoothingAutoFactorHelp": {
"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.",
"description": "Auto Factor parameter help message"
"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.",
"description": "SetPoint Auto Factor parameter help message"
},
"receiverRcSmoothingAutoFactorHelp2": {
"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.",
"description": "Auto Factor parameter help message"
"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.",
"description": "SetPoint Auto Factor parameter help message"
},
"receiverRcSmoothingAutoFactorThrottle": {
"message": "Throttle Auto Factor",
"description": "Throttle Auto Factor parameter for RC smoothing"
},
"receiverRcSmoothingAutoFactorThrottleHelp": {
"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.",
"description": "Throttle Auto Factor parameter help message"
},
"receiverRcFeedforwardTypeSelect": {
"message": "Feedforward Cutoff Type"
},
"receiverRcSetpointTypeSelect": {
"message": "Setpoint Cutoff Type"
},
"receiverThrottleTypeSelect": {
"message": "Throttle Cutoff Type"
},
"receiverRcSmoothingInterpolation": {
"message": "Interpolation"
},
Expand All @@ -2095,9 +2106,18 @@
"receiverRcSmoothingFeedforwardManual": {
"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."
},
"receiverRcSmoothingThrottleManual": {
"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."
},
"rcSmoothingThrottleCutoffHelp": {
"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\"."
},
"receiverRcSmoothingSetpointHz": {
"message": "Setpoint Cutoff Frequency"
},
"receiverRcSmoothingThrottleCutoffHz": {
"message": "Throttle Cutoff Frequency"
},
"receiverRcSmoothingFeedforwardCutoff": {
"message": "Feedforward Cutoff Frequency"
},
Expand Down
2 changes: 2 additions & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,12 @@ const FC = {
fpvCamAngleDegrees: 0,
rcSmoothingType: 0,
rcSmoothingSetpointCutoff: 0,
rcSmoothingThrottleCutoff: 0,
rcSmoothingFeedforwardCutoff: 0,
rcSmoothingInputType: 0,
rcSmoothingDerivativeType: 0,
rcSmoothingAutoFactor: 0,
rcSmoothingAutoFactorThrottle: 0,
usbCdcHidType: 0,
rcSmoothing: 0,
elrsUid: [0, 0, 0, 0, 0, 0],
Expand Down
22 changes: 16 additions & 6 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,13 @@ MspHelper.prototype.process_data = function (dataHandler) {
data.readU8(); // was FC.RX_CONFIG.rcInterpolationChannels
data.readU8(); // was FC.RX_CONFIG.rcSmoothingType
FC.RX_CONFIG.rcSmoothingSetpointCutoff = data.readU8();
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = data.readU8(); // deprecated in 1.47
data.readU8(); // was FC.RX_CONFIG.rcSmoothingInputType
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
FC.RX_CONFIG.rcSmoothingThrottleCutoff = data.readU8();
FC.RX_CONFIG.rcSmoothingAutoFactorThrottle = data.readU8();
} else {
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = data.readU8(); // deprecated in 1.47
data.readU8(); // was FC.RX_CONFIG.rcSmoothingDerivativeCutoff
}
data.readU8(); // was FC.RX_CONFIG.rcSmoothingDerivativeType
FC.RX_CONFIG.usbCdcHidType = data.readU8();
FC.RX_CONFIG.rcSmoothingAutoFactor = data.readU8();
Expand Down Expand Up @@ -1995,10 +2000,15 @@ MspHelper.prototype.crunch = function (code, modifierCode = undefined) {
.push8(FC.RX_CONFIG.fpvCamAngleDegrees)
.push8(FC.RX_CONFIG.rcInterpolationChannels)
.push8(FC.RX_CONFIG.rcSmoothingType)
.push8(FC.RX_CONFIG.rcSmoothingSetpointCutoff)
.push8(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff) // deprecated in 1.47
.push8(FC.RX_CONFIG.rcSmoothingInputType)
.push8(FC.RX_CONFIG.rcSmoothingDerivativeType);
.push8(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
buffer.push8(FC.RX_CONFIG.rcSmoothingThrottleCutoff);
buffer.push8(FC.RX_CONFIG.rcSmoothingAutoFactorThrottle);
} else {
buffer.push8(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
buffer.push8(FC.RX_CONFIG.rcSmoothingInputType);
}
buffer.push8(FC.RX_CONFIG.rcSmoothingDerivativeType);

// Introduced in 1.42
buffer.push8(FC.RX_CONFIG.usbCdcHidType).push8(FC.RX_CONFIG.rcSmoothingAutoFactor);
Expand Down
58 changes: 56 additions & 2 deletions src/js/tabs/receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,21 @@ receiver.initialize = function (callback) {

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

if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
$('select[name="rcSmoothing-setpoint-manual-select"]').val(0).trigger("change");
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
FC.RX_CONFIG.rcSmoothingThrottleCutoff = Number.parseInt(
$('input[name="rcSmoothingThrottleCutoffHz-number"]').val(),
);
if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
$('select[name="rcSmoothing-throttle-manual-select"]').val(0).trigger("change");
}
FC.RX_CONFIG.rcSmoothingAutoFactorThrottle = Number.parseInt(
$('input[name="rcSmoothingAutoFactorThrottle-number"]').val(),
);
} else {
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = parseInt(
$('input[name="rcSmoothingFeedforwardCutoff-number"]').val(),
);
Expand Down Expand Up @@ -649,7 +663,29 @@ receiver.initialize = function (callback) {

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
$(".tab-receiver .rcSmoothing-feedforward-manual").hide();

const rcSmoothingThrottleNumberElement = $('input[name="rcSmoothingThrottleCutoffHz-number"]');
rcSmoothingThrottleNumberElement.val(FC.RX_CONFIG.rcSmoothingThrottleCutoff);

$('select[name="rcSmoothing-throttle-manual-select"]').val("1");
if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
$('select[name="rcSmoothing-throttle-manual-select"]').val("0");
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
}
$('select[name="rcSmoothing-throttle-manual-select"]')
.on("change", function () {
if ($(this).val() === "0") {
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
rcSmoothingThrottleNumberElement.val(0);
}
if ($(this).val() === "1") {
$(".tab-receiver .rcSmoothing-throttle-cutoff").show();
rcSmoothingThrottleNumberElement.val(FC.RX_CONFIG.rcSmoothingThrottleCutoff);
}
})
.trigger("change");
} else {
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
const rcSmoothingFeedforwardNumberElement = $('input[name="rcSmoothingFeedforwardCutoff-number"]');

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

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

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
$('input[name="rcSmoothingAutoFactorThrottle-number"]').val(FC.RX_CONFIG.rcSmoothingAutoFactorThrottle);
} else {
$(".tab-receiver .rcSmoothing-auto-factor-throttle").hide();
}

updateInterpolationView();

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

if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
$(".tab-receiver .rcSmoothing-throttle-manual").show();
} else {
$(".tab-receiver .rcSmoothing-feedforward-manual").show();
}

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

if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0 || FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
$(".tab-receiver .rcSmoothing-auto-factor").show();
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
$(".tab-receiver .rcSmoothing-auto-factor-throttle").show();
}
}

$(".tab-receiver .rcSmoothingOff").text(i18n.getMessage("off"));
Expand All @@ -970,9 +1017,12 @@ function updateInterpolationView() {
if (FC.RX_CONFIG.rcSmoothing === 0) {
$(".tab-receiver .rcSmoothing-feedforward-cutoff").hide();
$(".tab-receiver .rcSmoothing-setpoint-cutoff").hide();
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
$(".tab-receiver .rcSmoothing-feedforward-manual").hide();
$(".tab-receiver .rcSmoothing-setpoint-manual").hide();
$(".tab-receiver .rcSmoothing-throttle-manual").hide();
$(".tab-receiver .rcSmoothing-auto-factor").hide();
$(".tab-receiver .rcSmoothing-auto-factor-throttle").hide();
}

if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0) {
Expand All @@ -982,6 +1032,10 @@ function updateInterpolationView() {
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
$(".tab-receiver .rcSmoothing-setpoint-cutoff").hide();
}

if (FC.RX_CONFIG.rcSmoothingThrottleCutoff === 0) {
$(".tab-receiver .rcSmoothing-throttle-cutoff").hide();
}
}

TABS.receiver = receiver;
Expand Down
74 changes: 61 additions & 13 deletions src/tabs/receiver.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,48 +226,96 @@
</div>
</td>
</tr>
<tr class="rcSmoothing-feedforward-manual">

<tr class="rcSmoothing-auto-factor">
<td>
<select name="rcSmoothing-feedforward-select">
<input type="number" name="rcSmoothingAutoFactor-number" step="1" min="0" max="250">
</td>
<td>
<div>
<label>
<span i18n="receiverRcSmoothingAutoFactor"></span>
</label>
</div>
</td>
<td>
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorHelp" i18n_title="receiverRcSmoothingAutoFactorHelp"></div>
</td>
</tr>

<tr class="rcSmoothing-throttle-manual">
<td>
<select name="rcSmoothing-throttle-manual-select">
<option value="0" i18n="receiverRcSmoothingAuto"></option>
<option value="1" i18n="receiverRcSmoothingManual"></option>
</select>
</td>
<td>
<div>
<label>
<span i18n="receiverRcFeedforwardTypeSelect"></span>
<span i18n="receiverThrottleTypeSelect"></span>
</label>
</div>
</td>
<td>
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingFeedforwardManual"></div>
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingThrottleManual"></div>
</td>
</tr>
<tr class="rcSmoothing-feedforward-manual">
<td class="rcSmoothing-feedforward-cutoff"><input type="number" name="rcSmoothingFeedforwardCutoff-number" step="1" min="1" max="255"/></td>
<td colspan="2" class="rcSmoothing-feedforward-cutoff">
<tr class="rcSmoothing-throttle-manual">
<td class="rcSmoothing-throttle-cutoff"><input type="number" name="rcSmoothingThrottleCutoffHz-number" step="1" min="0" max="255"/></td>
<td class="rcSmoothing-throttle-cutoff" colspan="2">
<div>
<label>
<span i18n="receiverRcSmoothingFeedforwardCutoff"></span>
<span i18n="receiverRcSmoothingThrottleCutoffHz"></span>
</label>
<div class="helpicon cf_tip" i18n_title="rcSmoothingFeedforwardCutoffHelp"></div>
<div class="helpicon cf_tip" i18n_title="rcSmoothingThrottleCutoffHelp"></div>
</div>
</td>
</tr>
<tr class="rcSmoothing-auto-factor">

<tr class="rcSmoothing-auto-factor-throttle">
<td>
<input type="number" name="rcSmoothingAutoFactor-number" step="1" min="0" max="250">
<input type="number" name="rcSmoothingAutoFactorThrottle-number" step="1" min="0" max="250">
</td>
<td>
<div>
<label>
<span i18n="receiverRcSmoothingAutoFactor"></span>
<span i18n="receiverRcSmoothingAutoFactorThrottle"></span>
</label>
</div>
</td>
<td>
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorHelp" i18n_title="receiverRcSmoothingAutoFactorHelp"></div>
<div class="helpicon cf_tip receiverRcSmoothingAutoFactorThrottleHelp" i18n_title="receiverRcSmoothingAutoFactorThrottleHelp"></div>
</td>
</tr>

<tr class="rcSmoothing-feedforward-manual">
<td>
<select name="rcSmoothing-feedforward-select">
<option value="0" i18n="receiverRcSmoothingAuto"></option>
<option value="1" i18n="receiverRcSmoothingManual"></option>
</select>
</td>
<td>
<div>
<label>
<span i18n="receiverRcFeedforwardTypeSelect"></span>
</label>
</div>
</td>
<td>
<div class="helpicon cf_tip" i18n_title="receiverRcSmoothingFeedforwardManual"></div>
</td>
</tr>
<tr class="rcSmoothing-feedforward-manual">
<td class="rcSmoothing-feedforward-cutoff"><input type="number" name="rcSmoothingFeedforwardCutoff-number" step="1" min="1" max="255"/></td>
<td colspan="2" class="rcSmoothing-feedforward-cutoff">
<div>
<label>
<span i18n="receiverRcSmoothingFeedforwardCutoff"></span>
</label>
<div class="helpicon cf_tip" i18n_title="rcSmoothingFeedforwardCutoffHelp"></div>
</div>
</td>
</tr>
</table>
Expand Down