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

HideMotorPoles

Suggested changes

Doblewhitespace
This commit is contained in:
Asizon 2019-10-27 16:33:30 +01:00
parent fcb78e2b8f
commit df2db988d5

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');