diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 6e209195..ee17ee77 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1750,5 +1750,32 @@ }, "yawPLimitHelp": { "message": "Limiter for yaw P term. Increasing it improves yaw authority but can cause instability on ROLL and PITCH." + }, + "tabFiltering": { + "message": "Filtering" + }, + "gyroLpfCutoffFrequency": { + "message": "Gyro LPF cutoff frequency" + }, + "gyroLpfCutoffFrequencyHelp": { + "message": "Software-based filter to remove mechanical vibrations from the gyro signal. Value is cutoff frequency (Hz). For larger frames with bigger props set to lower value. Too high value can cause motor and ESC overheating." + }, + "accLpfCutoffFrequency": { + "message": "Accelerometer LPF cutoff frequency" + }, + "accLpfCutoffFrequencyHelp": { + "message": "Software-based filter to remove mechanical vibrations from the accelerometer measurements. Value is cutoff frequency (Hz). For larger frames with bigger props set to lower value." + }, + "dtermLpfCutoffFrequency": { + "message": "D-term LPF cutoff frequency" + }, + "dtermLpfCutoffFrequencyHelp": { + "message": "Lowpass cutoff filter for Dterm for all PID controllers" + }, + "yawLpfCutoffFrequency": { + "message": "Yaw LPF cutoff frequency" + }, + "yawLpfCutoffFrequencyHelp": { + "message": "Yaw P-term LPF cutoff frequency" } } diff --git a/js/fc.js b/js/fc.js index 39d1ec06..4e6c5748 100644 --- a/js/fc.js +++ b/js/fc.js @@ -40,6 +40,7 @@ var RXFAIL_CONFIG; var ADVANCED_CONFIG; var INAV_PID_CONFIG; var PID_ADVANCED; +var FILTER_CONFIG; var FC = { isRatesInDps: function () { @@ -212,6 +213,12 @@ var FC = { gyroSync: null }; + FILTER_CONFIG = { + gyroSoftLpfHz: null, + dtermLpfHz: null, + yawLpfHz: null + } + PID_ADVANCED = { rollPitchItermIgnoreRate: null, yawItermIgnoreRate: null, diff --git a/js/msp.js b/js/msp.js index d0684edb..854acb86 100644 --- a/js/msp.js +++ b/js/msp.js @@ -1102,6 +1102,24 @@ var MSP = { console.log("Advanced config saved"); break; + case MSP_codes.MSP_FILTER_CONFIG: + FILTER_CONFIG.gyroSoftLpfHz = data.getUint8(0, true); + FILTER_CONFIG.dtermLpfHz = data.getUint16(1, true); + FILTER_CONFIG.yawLpfHz = data.getUint16(3, true); + /* + sbufWriteU16(dst, 1); //masterConfig.gyro_soft_notch_hz_1 + sbufWriteU16(dst, 1); //BF: masterConfig.gyro_soft_notch_cutoff_1 + sbufWriteU16(dst, 1); //BF: currentProfile->pidProfile.dterm_notch_hz + sbufWriteU16(dst, 1); //currentProfile->pidProfile.dterm_notch_cutoff + sbufWriteU16(dst, 1); //BF: masterConfig.gyro_soft_notch_hz_2 + sbufWriteU16(dst, 1); //BF: masterConfig.gyro_soft_notch_cutoff_2 + */ + break; + + case MSP_codes.MSP_SET_FILTER_CONFIG: + console.log("Filter config saved"); + break; + case MSP_codes.MSP_PID_ADVANCED: PID_ADVANCED.rollPitchItermIgnoreRate = data.getUint16(0, true); PID_ADVANCED.yawItermIgnoreRate = data.getUint16(2, true); @@ -1552,6 +1570,34 @@ MSP.crunch = function (code) { buffer.push(0); //reserved break; + case MSP_codes.MSP_SET_FILTER_CONFIG: + buffer.push(FILTER_CONFIG.gyroSoftLpfHz); + + buffer.push(lowByte(FILTER_CONFIG.dtermLpfHz)); + buffer.push(highByte(FILTER_CONFIG.dtermLpfHz)); + + buffer.push(lowByte(FILTER_CONFIG.yawLpfHz)); + buffer.push(highByte(FILTER_CONFIG.yawLpfHz)); + + buffer.push(0); + buffer.push(0); + + buffer.push(0); + buffer.push(0); + + buffer.push(0); + buffer.push(0); + + buffer.push(0); + buffer.push(0); + + buffer.push(0); + buffer.push(0); + + buffer.push(0); + buffer.push(0); + break; + case MSP_codes.MSP_SET_PID_ADVANCED: buffer.push(lowByte(PID_ADVANCED.rollPitchItermIgnoreRate)); buffer.push(highByte(PID_ADVANCED.rollPitchItermIgnoreRate)); diff --git a/tabs/pid_tuning.css b/tabs/pid_tuning.css index 6dbf1d62..ab8f84da 100644 --- a/tabs/pid_tuning.css +++ b/tabs/pid_tuning.css @@ -1,23 +1,23 @@ -.rate-tpa.rate-tpa--inav input[type="number"] { +/*.rate-tpa.rate-tpa--inav input[type="number"],*/ +.rate-tpa_input { margin: 4px; width: auto; border: 1px solid silver; border-radius: 3px; display: inline-block; + line-height: 20px; + text-align: right; } -.rate-tpa.rate-tpa--inav td { +.rate-tpa.rate-tpa--inav td, +.rate-tpa.rate-tpa--filtering td { background-color: #DEDEDE; width: auto; border-bottom: 1px solid #ccc; } -.tab-pid_tuning .rate-tpa.rate-tpa--inav th:first-child { - border-top-left-radius: 0; -} - -.tab-pid_tuning .rate-tpa.rate-tpa--inav .roll { - border-bottom-left-radius: 0; +.tab-pid_tuning .rate-tpa.rate-tpa--filtering th { + width: 18em; } .tab-pid_tuning .rate-tpa th { @@ -66,16 +66,12 @@ width: calc(100% - 10px); } -.tab-pid_tuning .rate-tpa th:nth-child(2) { - border-top-left-radius: 3px; +.tab-pid_tuning .rate-tpa tr:first-child th { + border-top-left-radius: 5px; } -.tab-pid_tuning .rate-tpa th:first-child { - border-top-left-radius: 3px; -} - -.tab-pid_tuning .rate-tpa th:last-child { - border-top-right-radius: 3px; +.tab-pid_tuning .rate-tpa tr:first-child td { + border-top-right-radius: 5px; } .tab-pid_tuning .rate-tpa { @@ -145,7 +141,7 @@ padding-left: 0px; } -.tab-pid_tuning table input { +.pid-section input { display: block; width: calc(100% - 0px); height: 20px; @@ -357,10 +353,6 @@ border-top-left-radius: 0px; } -.tab-pid_tuning .roll { - border-bottom-left-radius: 3px; -} - .tab-pid_tuning .pidTuningLevel { float: left; } diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 9a7c91b9..c98714ad 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -13,13 +13,11 @@
- -