diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cea484b2..71beb21e 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1930,5 +1930,41 @@ }, "presetApplyHead": { "message": "Applies following settings:" + }, + "gyroNotchHz1": { + "message": "First gyro notch filter freq." + }, + "gyroNotchCutoff1": { + "message": "First gyro notch filter cutoff freq." + }, + "gyroNotchHz2": { + "message": "Second gyro notch filter freq." + }, + "gyroNotchCutoff2": { + "message": "Second gyro notch filter cutoff freq." + }, + "gyroNotchHz1Help": { + "message": "Should be tuned to propeller harmonic frequency. Usually equals [motor_frequency] * [propeller_blades_number]

Has to be above cutoff frequency

0 disables the filter" + }, + "gyroNotchHz2Help": { + "message": "Should be tuned to motor frequency.

Has to be above cutoff frequency and below first gyro notch filter frequency.

0 disables the filter" + }, + "gyroNotchCutoff1Help": { + "message": "Defines band of notch filter.

Has to be kept below notch filter frequency." + }, + "gyroNotchCutoff2Help": { + "message": "Defines band of notch filter.

Has to be kept below notch filter frequency." + }, + "dtermNotchHz": { + "message": "Dterm notch filter freq." + }, + "dtermNotchCutoff": { + "message": "Dterm notch filter cutoff freq." + }, + "dtermNotchHzHelp": { + "message": "Should be placed between first and second gyro notch filter frequency

Has to be above cutoff frequency

0 disables the filter" + }, + "dtermNotchCutoffHelp": { + "message": "Defines band of filter.

Has to be kept below notch filter frequency." } } \ No newline at end of file diff --git a/js/fc.js b/js/fc.js index 15a93457..e34e75be 100644 --- a/js/fc.js +++ b/js/fc.js @@ -252,7 +252,8 @@ var FC = { yawPLimit: null, axisAccelerationLimitRollPitch: null, axisAccelerationLimitYaw: null, - dtermSetpointWeight: null + dtermSetpointWeight: null, + pidSumLimit: null }; INAV_PID_CONFIG = { diff --git a/js/gui.js b/js/gui.js index c835da9e..f6b0a6a9 100644 --- a/js/gui.js +++ b/js/gui.js @@ -221,5 +221,23 @@ GUI_control.prototype.fillSelect = function ($element, values, currentValue, uni } }; +GUI_control.prototype.simpleBind = function () { + $('input[data-simple-bind]').not('[data-simple-binded="true"]').each(function () { + var $this = $(this), + toBind = $this.data('simple-bind').split("."); + + if (toBind.length !== 2 || window[toBind[0]][toBind[1]] === undefined) { + return; + } + + $this.change(function () { + window[toBind[0]][toBind[1]] = $(this).val(); + }); + + $this.val(window[toBind[0]][toBind[1]]); + $this.attr('data-simple-binded', true); + }); +}; + // initialize object into GUI variable var GUI = new GUI_control(); diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index e3934daa..3265615d 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -846,6 +846,7 @@ var mspHelper = (function (gui) { if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) { PID_ADVANCED.dtermSetpointWeight = data.getUint8(9); + PID_ADVANCED.pidSumLimit = data.getUint16(10, true); } PID_ADVANCED.axisAccelerationLimitRollPitch = data.getUint16(13, true); @@ -1262,12 +1263,14 @@ var mspHelper = (function (gui) { if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) { buffer.push(PID_ADVANCED.dtermSetpointWeight); + buffer.push(lowByte(PID_ADVANCED.pidSumLimit)); + buffer.push(highByte(PID_ADVANCED.pidSumLimit)); } else { buffer.push(0); + buffer.push(0); // reserved + buffer.push(0); // reserved } - buffer.push(0); // reserved - buffer.push(0); // reserved buffer.push(0); //BF: currentProfile->pidProfile.itermThrottleGain buffer.push(lowByte(PID_ADVANCED.axisAccelerationLimitRollPitch)); diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 63a067c1..a32f9287 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -219,6 +219,35 @@ + + + + Hz +
+ + + + + + Hz +
+ + + + + + Hz +
+ + + + + + Hz +
+ + + @@ -239,6 +268,20 @@
+ + + + Hz +
+ + + + + + Hz +
+ + diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index e7827cbb..a192047e 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -231,6 +231,15 @@ TABS.pid_tuning.initialize = function (callback) { } else { $('.requires-v1_4').hide(); } + + if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) { + $('.requires-v1_6').show(); + } else { + $('.requires-v1_6').hide(); + } + + GUI.simpleBind(); + // UI Hooks $('a.refresh').click(function () {