Skip to content

Commit 84e2cad

Browse files
authored
Merge pull request #1142 from smoriarty21/rc_smoothing
WIP: Adding rc smoothing to configurator
2 parents 153ed92 + 5a3bda6 commit 84e2cad

File tree

6 files changed

+461
-45
lines changed

6 files changed

+461
-45
lines changed

locales/en/messages.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,69 @@
12811281
"pidTuningPidSettings": {
12821282
"message": "PID Controller Settings"
12831283
},
1284+
"receiverRcSmoothing": {
1285+
"message": "RC Smoothing"
1286+
},
1287+
"receiverRcSmoothingAuto": {
1288+
"message": "Auto"
1289+
},
1290+
"receiverRcSmoothingManual": {
1291+
"message": "Manual"
1292+
},
1293+
"receiverRcDerivativeTypeSelect": {
1294+
"message": "Derivative Cutoff Type"
1295+
},
1296+
"receiverRcInputTypeSelect": {
1297+
"message": "Input Cutoff Type"
1298+
},
1299+
"receiverRcSmoothingInterpolation": {
1300+
"message": "Interpolation"
1301+
},
1302+
"receiverRcSmoothingFilter": {
1303+
"message": "Filter"
1304+
},
1305+
"receiverRcSmoothingTypeHelp": {
1306+
"message": "Type of RC smoothing used"
1307+
},
1308+
"rcSmoothingInputCutoffHelp": {
1309+
"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\"."
1310+
},
1311+
"rcSmoothingDerivativeCutoffHelp": {
1312+
"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\"."
1313+
},
1314+
"rcSmoothingChannelsSmoothedHelp": {
1315+
"message": "The channels smoothing applies to"
1316+
},
1317+
"rcSmoothingDerivativeTypeHelp": {
1318+
"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."
1319+
},
1320+
"rcSmoothingInputTypeHelp": {
1321+
"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."
1322+
},
1323+
"receiverRcSmoothingInputManual": {
1324+
"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."
1325+
},
1326+
"receiverRcSmoothingDerivativeManual": {
1327+
"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."
1328+
},
1329+
"receiverRcSmoothingInputHz": {
1330+
"message": "Input Cutoff Frequency"
1331+
},
1332+
"receiverRcSmoothingDerivativeCutoff": {
1333+
"message": "Derivative Cutoff Frequency"
1334+
},
1335+
"receiverRcInputType": {
1336+
"message": "Input Filter Type"
1337+
},
1338+
"receiverRcDerivativeType": {
1339+
"message": "Derivative Filter Type"
1340+
},
1341+
"receiverRcSmoothingDerivativeTypeOff": {
1342+
"message": "Off"
1343+
},
1344+
"receiverRcSmoothingChannel": {
1345+
"message": "Channels Smoothed"
1346+
},
12841347
"receiverRcInterpolation": {
12851348
"message": "RC Interpolation"
12861349
},
@@ -1293,6 +1356,9 @@
12931356
"receiverRcInterpolationOff": {
12941357
"message": "Off"
12951358
},
1359+
"receiverRcSmoothingType": {
1360+
"message": "Smoothing Type"
1361+
},
12961362
"receiverRcInterpolationDefault": {
12971363
"message": "Preset"
12981364
},

src/css/tabs/receiver.css

Lines changed: 97 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@
195195
border-right: 1px solid silver;
196196
}
197197

198+
.tab-receiver .smoothing table td {
199+
background: #DEDEDE;
200+
border-right: 0px;
201+
}
202+
198203
.tab-receiver .tunings table td:first-child {
199204
border-bottom-left-radius: 3px;
200205
}
@@ -305,46 +310,121 @@
305310
width: calc(100% - 10px);
306311
}
307312

308-
.tab-receiver .rcInterpolation td {
309-
padding: 5px;
313+
.tab-receiver .rcSmoothing-derivative-manual select {
314+
height: 22px;
315+
padding-left: 5px;
316+
border: 1px solid silver;
317+
margin: 4px;
318+
}
319+
320+
.tab-receiver .rcSmoothing-input-manual select {
321+
height: 22px;
322+
padding-left: 5px;
323+
border: 1px solid silver;
324+
margin: 4px;
325+
width: calc(100% - 8px);
326+
}
327+
328+
.tab-receiver .rcSmoothing-input-manual select {
329+
height: 22px;
330+
padding-left: 5px;
331+
border: 1px solid silver;
332+
margin: 4px;
333+
width: calc(100% - 8px);
334+
}
335+
336+
.tab-receiver .rc-smoothing-type {
337+
margin-bottom: 5px;
338+
clear: left;
339+
padding-bottom: 5px;
310340
width: 100%;
311-
background-color: #f9f9f9 !important;
312341
}
313342

314-
.tab-receiver .rcInterpolationInterval td {
315-
padding: 5px;
343+
.tab-receiver .rc-smoothing-channels {
344+
margin-bottom: 5px;
345+
clear: left;
346+
padding-bottom: 5px;
347+
border-bottom: 1px solid silver;
316348
width: 100%;
317-
background-color: #f9f9f9 !important;
318-
border-top: 1px solid silver;
319349
}
320350

321-
.tab-receiver .rcInterpolation td:first-child {
322-
width: 70px;
323-
padding-bottom: 10px;
324-
padding-top: 10px;
325-
padding-left:8px;
326-
border-right: none;
351+
.tab-receiver .rc-smoothing-type select {
352+
height: 22px;
353+
padding-left: 5px;
354+
border: 1px solid silver;
355+
margin: 4px;
356+
width: calc(100% - 8px);
327357
}
328358

329-
.tab-receiver .rcInterpolation td:last-child {
330-
width: calc(100% - 78px);
359+
.tab-receiver .rc-smoothing-channels select {
360+
height: 22px;
361+
padding-left: 5px;
362+
border: 1px solid silver;
363+
margin: 4px;
364+
width: calc(100% - 8px);
365+
}
366+
367+
.tab-receiver .rcSmoothing-input-type select {
368+
height: 22px;
369+
padding-left: 5px;
370+
border: 1px solid silver;
371+
margin: 4px;
372+
width: calc(100% - 8px);
331373
}
332374

375+
.tab-receiver .rcSmoothing-input-type select {
376+
height: 22px;
377+
padding-left: 5px;
378+
border: 1px solid silver;
379+
margin: 4px;
380+
width: calc(100% - 8px);
381+
}
333382

334383
.tab-receiver .rcInterpolation select {
384+
height: 22px;
385+
padding-left: 5px;
335386
border: 1px solid silver;
336-
width: 66px;
387+
margin: 4px;
388+
width: calc(100% - 8px);
389+
float: left;
390+
}
391+
392+
.tab-receiver .rcInterpolation-label {
393+
margin-top: 6px;
394+
border-right: 1px solid silver;
395+
}
396+
397+
.tab-receiver .rcSmoothing-derivative-type select {
398+
height: 22px;
399+
padding-left: 5px;
400+
border: 1px solid silver;
401+
margin: 4px;
402+
width: calc(100% - 8px);
403+
}
404+
405+
.tab-receiver .rcSmoothing td:first-child {
406+
width: 120px;
407+
padding-left:8px;
408+
border-right: none;
409+
}
410+
411+
.tab-receiver .rcSmoothing td:last-child {
412+
width: calc(100% - 78px);
337413
}
338414

339415
.tab-receiver .rcInterpolation .slider input {
340-
-webkit-appearance: slider-horizontal
416+
-webkit-appearance: slider-horizontal;
341417
}
342418

343419
.tab-receiver .curves {
344420
float: left;
345421
margin-right: 10px;
346422
}
347423

424+
.tab-receiver .rcInterpolation-label {
425+
border-right: none;
426+
}
427+
348428
.tab-receiver .throttle_curve {
349429
margin: 0 0px 0px 0;
350430
width: 200px;

src/js/fc.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -390,20 +390,26 @@ var FC = {
390390
};
391391

392392
RX_CONFIG = {
393-
serialrx_provider: 0,
394-
stick_max: 0,
395-
stick_center: 0,
396-
stick_min: 0,
397-
spektrum_sat_bind: 0,
398-
rx_min_usec: 0,
399-
rx_max_usec: 0,
400-
rcInterpolation: 0,
401-
rcInterpolationInterval: 0,
402-
airModeActivateThreshold: 0,
403-
rxSpiProtocol: 0,
404-
rxSpiId: 0,
405-
rxSpiRfChannelCount: 0,
406-
fpvCamAngleDegrees: 0,
393+
serialrx_provider: 0,
394+
stick_max: 0,
395+
stick_center: 0,
396+
stick_min: 0,
397+
spektrum_sat_bind: 0,
398+
rx_min_usec: 0,
399+
rx_max_usec: 0,
400+
rcInterpolation: 0,
401+
rcInterpolationInterval: 0,
402+
rcInterpolationChannels: 0,
403+
airModeActivateThreshold: 0,
404+
rxSpiProtocol: 0,
405+
rxSpiId: 0,
406+
rxSpiRfChannelCount: 0,
407+
fpvCamAngleDegrees: 0,
408+
rcSmoothingType: 0,
409+
rcSmoothingInputCutoff: 0,
410+
rcSmoothingDerivativeCutoff: 0,
411+
rcSmoothingInputType: 0,
412+
rcSmoothingDerivativeType: 0,
407413
};
408414

409415
FAILSAFE_CONFIG = {

src/js/msp/MSPHelper.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
790790
RX_CONFIG.rxSpiId = data.readU32();
791791
RX_CONFIG.rxSpiRfChannelCount = data.readU8();
792792
RX_CONFIG.fpvCamAngleDegrees = data.readU8();
793+
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
794+
RX_CONFIG.rcInterpolationChannels = data.readU8();
795+
RX_CONFIG.rcSmoothingType = data.readU8();
796+
RX_CONFIG.rcSmoothingInputCutoff = data.readU8();
797+
RX_CONFIG.rcSmoothingDerivativeCutoff = data.readU8();
798+
RX_CONFIG.rcSmoothingInputType = data.readU8();
799+
RX_CONFIG.rcSmoothingDerivativeType = data.readU8();
800+
}
793801
} else {
794802
RX_CONFIG.rxSpiProtocol = 0;
795803
RX_CONFIG.rxSpiId = 0;
@@ -801,6 +809,8 @@ MspHelper.prototype.process_data = function(dataHandler) {
801809
RX_CONFIG.rcInterpolationInterval = 0;
802810
RX_CONFIG.airModeActivateThreshold = 0;
803811
}
812+
813+
804814
break;
805815

806816
case MSPCodes.MSP_FAILSAFE_CONFIG:
@@ -1403,6 +1413,7 @@ MspHelper.prototype.crunch = function(code) {
14031413
.push16(BF_CONFIG.batterycapacity)
14041414
}
14051415
break;
1416+
14061417
case MSPCodes.MSP_SET_RX_CONFIG:
14071418
buffer.push8(RX_CONFIG.serialrx_provider)
14081419
.push16(RX_CONFIG.stick_max)
@@ -1420,6 +1431,14 @@ MspHelper.prototype.crunch = function(code) {
14201431
.push32(RX_CONFIG.rxSpiId)
14211432
.push8(RX_CONFIG.rxSpiRfChannelCount)
14221433
.push8(RX_CONFIG.fpvCamAngleDegrees);
1434+
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
1435+
buffer.push8(RX_CONFIG.rcInterpolationChannels)
1436+
.push8(RX_CONFIG.rcSmoothingType)
1437+
.push8(RX_CONFIG.rcSmoothingInputCutoff)
1438+
.push8(RX_CONFIG.rcSmoothingDerivativeCutoff)
1439+
.push8(RX_CONFIG.rcSmoothingInputType)
1440+
.push8(RX_CONFIG.rcSmoothingDerivativeType);
1441+
}
14231442
}
14241443
}
14251444

0 commit comments

Comments
 (0)