diff --git a/locales/en/messages.json b/locales/en/messages.json index ef0fa052..cbf0a809 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1237,8 +1237,92 @@ "pidTuningPidSettings": { "message": "PID Controller Settings" }, + "receiverRcSmoothing": { + "message": "RC Smoothing" + }, + "receiverRcSmoothingAuto": { + "message": "Auto" + }, + "receiverRcSmoothingManual": { + "message": "Manual" + }, + "receiverRcDerivativeTypeSelect": { + "message": "Derivative Cutoff Type" + }, + "receiverRcInputTypeSelect": { + "message": "Input Cutoff Type" + }, + "receiverRcSmoothingInterpolation": { + "message": "Interpolation" + }, + "receiverRcSmoothingFilter": { + "message": "Filter" + }, + "receiverRcSmoothingTypeHelp": { + "message": "Type of RC smoothing used" + }, + "rcSmoothingInputCutoffHelp": { + "message": "The cutoff frequency in Hz used by the input 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\"." + }, + "rcSmoothingDerivativeCutoffHelp": { + "message": "The cutoff frequency in Hz used by the setpoint derivative 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\"." + }, + "rcSmoothingChannelsSmoothedHelp": { + "message": "The channels smoothing applies to" + }, + "rcSmoothingDerivativeTypeHelp": { + "message": "The type of filtering method used for the setpoint derivative. Most users should use the default \"BIQUAD\" value as it provides a good balance between smoothness and delay. \"PT1\" reduces the delay slightly but provides less smoothing." + }, + "rcSmoothingInputTypeHelp": { + "message": "The type of filtering method used for the input. Most users should use the default \"BIQUAD\" value as it provides a good balance between smoothness and delay. \"PT1\" reduces the delay slightly but provides less smoothing." + }, + "receiverRcSmoothingInputManual": { + "message": "Selects whether the input 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." + }, + "receiverRcSmoothingDerivativeManual": { + "message": "Selects whether the setpoint derivative 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." + }, + "receiverRcSmoothingInputHz": { + "message": "Input Cutoff Frequency" + }, + "receiverRcSmoothingDerivativeCutoff": { + "message": "Derivative Cutoff Frequency" + }, + "receiverRcSmoothingInputTypeBiquad": { + "message": "BIQUAD" + }, + "receiverRcSmoothingInputTypePt1": { + "message": "PT1" + }, + "receiverRcInputType": { + "message": "Input Filter Type" + }, + "receiverRcDerivativeType": { + "message": "Derivative Filter Type" + }, + "receiverRcSmoothingDerivativeTypeOff": { + "message": "Off" + }, + "receiverRcSmoothingChannelsRP": { + "message": "RP" + }, + "receiverRcSmoothingChannelsRPY": { + "message": "Y" + }, + "receiverRcSmoothingChannelsRPYT": { + "message": "RPYT" + }, + "receiverRcSmoothingChannelsT": { + "message": "T" + }, + "receiverRcSmoothingChannelsRPT": { + "message": "RPT" + }, + "receiverRcSmoothingChannel": { + "message": "Channels Smoothed" + }, "receiverRcInterpolation": { - "message": "RC Interpolation" + "message": "Smoothing Type" }, "receiverRcInterpolationHelp": { "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." diff --git a/src/css/tabs/receiver.css b/src/css/tabs/receiver.css index 05193e24..9f17043f 100644 --- a/src/css/tabs/receiver.css +++ b/src/css/tabs/receiver.css @@ -195,6 +195,11 @@ border-right: 1px solid silver; } +.tab-receiver .smoothing table td { + background: #DEDEDE; + border-right: 0px; +} + .tab-receiver .tunings table td:first-child { border-bottom-left-radius: 3px; } @@ -305,6 +310,68 @@ width: calc(100% - 10px); } +.tab-receiver .rcSmoothing-derivative-manual select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} + +.tab-receiver .rcSmoothing-input-manual select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} + +.tab-receiver .rcSmoothing-type select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} + +.tab-receiver .rcSmoothing-channels select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} +.tab-receiver .rcSmoothing-input-type select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} + +.tab-receiver .rcSmoothing-derivative-type select { + height: 22px; + padding-left: 5px; + border: 1px solid silver; + margin: 4px; + width: calc(100% - 8px); +} + +.tab-receiver .rcSmoothing td:first-child { + width: 70px; + padding-left:8px; + border-right: none; +} + +.tab-receiver .rcSmoothing td:last-child { + width: calc(100% - 78px); +} + + +.tab-receiver .rcSmoothing select { + width: 66px; +} + .tab-receiver .rcInterpolation td { padding: 5px; width: 100%; @@ -337,7 +404,7 @@ } .tab-receiver .rcInterpolation .slider input { - -webkit-appearance: slider-horizontal + -webkit-appearance: slider-horizontal; } .tab-receiver .curves { diff --git a/src/js/fc.js b/src/js/fc.js index f5216050..c74db6cb 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -378,20 +378,26 @@ var FC = { }; RX_CONFIG = { - serialrx_provider: 0, - stick_max: 0, - stick_center: 0, - stick_min: 0, - spektrum_sat_bind: 0, - rx_min_usec: 0, - rx_max_usec: 0, - rcInterpolation: 0, - rcInterpolationInterval: 0, - airModeActivateThreshold: 0, - rxSpiProtocol: 0, - rxSpiId: 0, - rxSpiRfChannelCount: 0, - fpvCamAngleDegrees: 0, + serialrx_provider: 0, + stick_max: 0, + stick_center: 0, + stick_min: 0, + spektrum_sat_bind: 0, + rx_min_usec: 0, + rx_max_usec: 0, + rcInterpolation: 0, + rcInterpolationInterval: 0, + rcInterpolationChannels: 0, + airModeActivateThreshold: 0, + rxSpiProtocol: 0, + rxSpiId: 0, + rxSpiRfChannelCount: 0, + fpvCamAngleDegrees: 0, + rcSmoothingType: 0, + rcSmoothingInputCutoff: 0, + rcSmoothingDerivativeCutoff: 0, + rcSmoothingInputType: 0, + rcSmoothingDerivativeType: 0, }; FAILSAFE_CONFIG = { diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index b82c5c76..bf51b42e 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -764,6 +764,9 @@ MspHelper.prototype.process_data = function(dataHandler) { RX_CONFIG.spektrum_sat_bind = data.readU8(); RX_CONFIG.rx_min_usec = data.readU16(); RX_CONFIG.rx_max_usec = data.readU16(); + RX_CONFIG.rcInterpolation = 0; + RX_CONFIG.rcInterpolationInterval = 0; + RX_CONFIG.airModeActivateThreshold = 0; if (semver.gte(CONFIG.apiVersion, "1.20.0")) { RX_CONFIG.rcInterpolation = data.readU8(); RX_CONFIG.rcInterpolationInterval = data.readU8(); @@ -773,16 +776,15 @@ MspHelper.prototype.process_data = function(dataHandler) { RX_CONFIG.rxSpiId = data.readU32(); RX_CONFIG.rxSpiRfChannelCount = data.readU8(); RX_CONFIG.fpvCamAngleDegrees = data.readU8(); - } else { - RX_CONFIG.rxSpiProtocol = 0; - RX_CONFIG.rxSpiId = 0; - RX_CONFIG.rxSpiRfChannelCount = 0; - RX_CONFIG.fpvCamAngleDegrees = 0; + if (semver.gte(CONFIG.apiVersion, "1.40.0")) { + RX_CONFIG.rcInterpolationChannels = data.readU8(); + RX_CONFIG.rcSmoothingType = data.readU8(); + RX_CONFIG.rcSmoothingInputCutoff = data.readU8(); + RX_CONFIG.rcSmoothingDerivativeCutoff = data.readU8(); + RX_CONFIG.rcSmoothingInputType = data.readU8(); + RX_CONFIG.rcSmoothingDerivativeType = data.readU8(); + } } - } else { - RX_CONFIG.rcInterpolation = 0; - RX_CONFIG.rcInterpolationInterval = 0; - RX_CONFIG.airModeActivateThreshold = 0; } break; @@ -1360,6 +1362,7 @@ MspHelper.prototype.crunch = function(code) { .push16(BF_CONFIG.batterycapacity) } break; + case MSPCodes.MSP_SET_RX_CONFIG: buffer.push8(RX_CONFIG.serialrx_provider) .push16(RX_CONFIG.stick_max) @@ -1377,6 +1380,14 @@ MspHelper.prototype.crunch = function(code) { .push32(RX_CONFIG.rxSpiId) .push8(RX_CONFIG.rxSpiRfChannelCount) .push8(RX_CONFIG.fpvCamAngleDegrees); + if (semver.gte(CONFIG.apiVersion, "1.40.0")) { + buffer.push8(RX_CONFIG.rcInterpolationChannels) + .push8(RX_CONFIG.rcSmoothingType) + .push8(RX_CONFIG.rcSmoothingInputCutoff) + .push8(RX_CONFIG.rcSmoothingDerivativeCutoff) + .push8(RX_CONFIG.rcSmoothingInputType) + .push8(RX_CONFIG.rcSmoothingDerivativeType); + } } } diff --git a/src/js/tabs/receiver.js b/src/js/tabs/receiver.js index 2347065a..26f323e8 100644 --- a/src/js/tabs/receiver.js +++ b/src/js/tabs/receiver.js @@ -324,6 +324,83 @@ TABS.receiver.initialize = function (callback) { }); }); + // RC Smoothing + $('.tab-receiver .rcSmoothing').hide(); + if (semver.gte(CONFIG.apiVersion, "1.40.0")) { + $('.tab-receiver .rcSmoothing').show(); + + var rc_smoothing_protocol_e = $('select[name="rcSmoothing-select"]'); + rc_smoothing_protocol_e.change(function () { + RX_CONFIG.rcSmoothingType = $(this).val(); + updateInterpolationView(); + }); + rc_smoothing_protocol_e.val(RX_CONFIG.rcSmoothingType); + + var rcSmoothingnNumberElement = $('input[name="rcSmoothingInputHz-number"]'); + var rcSmoothingnDerivativeNumberElement = $('input[name="rcSmoothingDerivativeCutoff-number"]'); + + $('.tab-receiver .rcSmoothing-input-cutoff').show(); + $('select[name="rcSmoothing-input-manual-select"]').val("1"); + if (RX_CONFIG.rcSmoothingInputCutoff == 0) { + $('.tab-receiver .rcSmoothing-input-cutoff').hide(); + $('select[name="rcSmoothing-input-manual-select"]').val("0"); + } + $('select[name="rcSmoothing-input-manual-select"]').change(function () { + if ($(this).val() == 0) { + RX_CONFIG.rcSmoothingInputCutoff = 0; + $('.tab-receiver .rcSmoothing-input-cutoff').hide(); + } + if ($(this).val() == 1) { + rcSmoothingnNumberElement.val(RX_CONFIG.rcSmoothingInputCutoff); + $('.tab-receiver .rcSmoothing-input-cutoff').show(); + } + }); + + $('.tab-receiver .rcSmoothing-derivative-cutoff').show(); + $('select[name="rcSmoothing-input-derivative-select"]').val("1"); + if (RX_CONFIG.rcSmoothingDerivativeCutoff == 0) { + $('select[name="rcSmoothing-input-derivative-select"]').val("0"); + $('.tab-receiver .rcSmoothing-derivative-cutoff').hide(); + } + $('select[name="rcSmoothing-input-derivative-select"]').change(function () { + if ($(this).val() == 0) { + $('.tab-receiver .rcSmoothing-derivative-cutoff').hide(); + RX_CONFIG.rcSmoothingDerivativeCutoff = 0; + } + if ($(this).val() == 1) { + $('.tab-receiver .rcSmoothing-derivative-cutoff').show(); + rcSmoothingnDerivativeNumberElement.val(RX_CONFIG.rcSmoothingDerivativeCutoff); + } + }); + + rcSmoothingnNumberElement.change(function () { + RX_CONFIG.rcSmoothingInputCutoff = $(this).val(); + }); + rcSmoothingnNumberElement.val(RX_CONFIG.rcSmoothingInputCutoff); + + rcSmoothingnDerivativeNumberElement.change(function () { + RX_CONFIG.rcSmoothingDerivativeCutoff = $(this).val(); + }); + rcSmoothingnDerivativeNumberElement.val(RX_CONFIG.rcSmoothingDerivativeCutoff); + var rc_smoothing_derivative_type = $('select[name="rcSmoothingDerivativeType-select"]'); + rc_smoothing_derivative_type.change(function () { + RX_CONFIG.rcSmoothingDerivativeType = $(this).val(); + }); + rc_smoothing_derivative_type.val(RX_CONFIG.rcSmoothingDerivativeType); + var rc_smoothing_channels = $('select[name="rcSmoothingChannels-select"]'); + rc_smoothing_channels.change(function () { + RX_CONFIG.rcInterpolationChannels = $(this).val(); + }); + rc_smoothing_channels.val(RX_CONFIG.rcInterpolationChannels); + var rc_smoothing_input_type = $('select[name="rcSmoothingInputType-select"]'); + rc_smoothing_input_type.change(function () { + RX_CONFIG.rcSmoothingInputType = $(this).val(); + }); + rc_smoothing_input_type.val(RX_CONFIG.rcSmoothingInputType); + + updateInterpolationView(); + } + // Only show the MSP control sticks if the MSP Rx feature is enabled $(".sticks_btn").toggle(FEATURE_CONFIG.features.isEnabled('RX_MSP')); @@ -510,3 +587,29 @@ TABS.receiver.updateRcInterpolationParameters = function () { } } }; + +function updateInterpolationView() { + $('.tab-receiver .rcInterpolation').hide(); + $('.tab-receiver .rcSmoothing-derivative-cutoff').show(); + $('.tab-receiver .rcSmoothing-input-cutoff').show(); + $('.tab-receiver .rcSmoothing-derivative-type').show(); + $('.tab-receiver .rcSmoothing-input-type').show(); + $('.tab-receiver .rcSmoothing-derivative-manual').show(); + $('.tab-receiver .rcSmoothing-input-manual').show(); + + if (parseInt(RX_CONFIG.rcSmoothingType) === 0) { + $('.tab-receiver .rcInterpolation').show(); + $('.tab-receiver .rcSmoothing-derivative-cutoff').hide(); + $('.tab-receiver .rcSmoothing-input-cutoff').hide(); + $('.tab-receiver .rcSmoothing-derivative-type').hide(); + $('.tab-receiver .rcSmoothing-input-type').hide(); + $('.tab-receiver .rcSmoothing-derivative-manual').hide(); + $('.tab-receiver .rcSmoothing-input-manual').hide(); + } + if (parseInt(RX_CONFIG.rcSmoothingDerivativeCutoff) === 0) { + $('.tab-receiver .rcSmoothing-derivative-cutoff').hide(); + } + if (parseInt(RX_CONFIG.rcSmoothingInputCutoff) === 0) { + $('.tab-receiver .rcSmoothing-input-cutoff').hide(); + } +} \ No newline at end of file diff --git a/src/tabs/receiver.html b/src/tabs/receiver.html index 601db994..3478a598 100644 --- a/src/tabs/receiver.html +++ b/src/tabs/receiver.html @@ -114,6 +114,147 @@ +
+ | |||
---|---|---|---|
+ + | +
+
+
+
+ |
+ + + | +|
+ + | +
+
+
+
+ |
+ + + | +|
+ + | +
+
+
+
+ |
+ + + | +|
+ |
+
+
+
+
+ |
+ ||
+ + | +
+
+
+
+ |
+ + + | +|
+ |
+
+
+
+
+ |
+ ||
+ + | +
+
+
+
+ |
+ + + | +|
+ + | +
+
+
+
+ |
+ + + | +