1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +03:00

GUI for notch filters'

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-01-19 22:18:58 +01:00
parent 4f78f7c080
commit 51a550b1c2
4 changed files with 106 additions and 0 deletions

View file

@ -1921,5 +1921,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 <i>[motor_frequency] * [propeller_blades_number]</i><br><br>Has to be above cutoff frequency<br><br><i>0</i> disables the filter"
},
"gyroNotchHz2Help": {
"message": "Should be tuned to motor frequency.<br><br>Has to be above cutoff frequency and below first gyro notch filter frequency.<br><br><i>0</i> disables the filter"
},
"gyroNotchCutoff1Help": {
"message": "Defines band of notch filter. <br><br>Has to be kept below notch filter frequency."
},
"gyroNotchCutoff2Help": {
"message": "Defines band of notch filter. <br><br>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<br><br>Has to be above cutoff frequency<br><br><i>0</i> disables the filter"
},
"dtermNotchCutoffHelp": {
"message": "Defines band of filter. <br><br>Has to be kept below notch filter frequency."
}
}

View file

@ -220,5 +220,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();

View file

@ -219,6 +219,35 @@
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="gyroNotchHz1"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.gyroNotchHz1" id="gyroNotchHz1" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="gyroNotchHz1Help"></div>
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="gyroNotchCutoff1"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.gyroNotchCutoff1" id="gyroNotchCutoff1" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="gyroNotchCutoff1Help"></div>
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="gyroNotchHz2"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.gyroNotchHz2" id="gyroNotchHz2" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="gyroNotchHz2Help"></div>
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="gyroNotchCutoff2"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.gyroNotchCutoff2" id="gyroNotchCutoff2" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="gyroNotchCutoff2Help"></div>
</td>
</tr>
</tbody>
</table>
</div>
@ -239,6 +268,20 @@
<div class="helpicon cf_tip" data-i18n_title="yawLpfCutoffFrequencyHelp"></div>
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="dtermNotchHz"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.dtermNotchHz" id="dtermNotchHz" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="dtermNotchHzHelp"></div>
</td>
</tr>
<tr class="requires-v1_6">
<th data-i18n="dtermNotchCutoff"></th>
<td>
<input type="number" data-simple-bind="FILTER_CONFIG.dtermNotchCutoff" id="dtermNotchCutoff" class="rate-tpa_input" step="1" min="0" max="500" /> Hz
<div class="helpicon cf_tip" data-i18n_title="dtermNotchCutoffHelp"></div>
</td>
</tr>
</tbody>
</table>
</div>

View file

@ -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 () {