1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +03:00

Merge pull request #1774 from Asizon/hidemotorPoles

Hide Motor Poles when it is not necessary
This commit is contained in:
Michael Keller 2019-10-31 01:18:47 +13:00 committed by GitHub
commit a47aba8d7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -516,6 +516,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
}
function hideMotorPoles() {
let motorPolesVisible = $("input[id='dshotBidir']").is(':checked') || $("input[name='ESC_SENSOR']").is(':checked');
$('div.motorPoles').toggle(motorPolesVisible);
}
$('#escProtocolTooltip').toggle(semver.lt(CONFIG.apiVersion, "1.42.0"));
$('#escProtocolTooltipNoDSHOT1200').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
@ -542,13 +547,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('div.checkboxDshotBidir').toggle(semver.gte(CONFIG.apiVersion, "1.42.0") && digitalProtocol);
$('div.motorPoles').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
//trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab
$("input[id='dshotBidir']").change(hideMotorPoles).change();
$("input[name='ESC_SENSOR']").change(hideMotorPoles);
//trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input
$("input[id='unsyncedPWMSwitch']").change();
}).change();
// Gyro and PID update
var gyroUse32kHz_e = $('input[id="gyroUse32kHz"]');
var gyro_select_e = $('select.gyroSyncDenom');