1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-26 17:55:24 +03:00

Fix dshot bidir switch

typo fix

Fix dialog if rpm is disabled
This commit is contained in:
Asizon 2022-02-16 09:19:21 +01:00 committed by asizon
parent 1b1be26533
commit 15f49363de
2 changed files with 52 additions and 47 deletions

View file

@ -665,7 +665,7 @@ TABS.motors.initialize = function (callback) {
unsyncedPWMSwitchElement.prop('checked', FC.PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).trigger("change");
$('input[name="unsyncedpwmfreq"]').val(FC.PID_ADVANCED_CONFIG.motor_pwm_rate);
$('input[name="digitalIdlePercent"]').val(FC.PID_ADVANCED_CONFIG.digitalIdlePercent);
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
dshotBidirElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_telemetry).trigger("change");
self.previousDshotBidir = FC.MOTOR_CONFIG.use_dshot_telemetry;
@ -678,10 +678,12 @@ TABS.motors.initialize = function (callback) {
self.analyticsChanges['BidirectionalDshot'] = newValue;
FC.MOTOR_CONFIG.use_dshot_telemetry = value;
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
const rpmFilterIsDisabled = self.previousDshotBidir && FC.FILTER_CONFIG.gyro_rpm_notch_harmonics === 0;
FC.FILTER_CONFIG.dyn_notch_count = self.previousFilterDynCount;
FC.FILTER_CONFIG.dyn_notch_q = self.previousFilterDynQ;
const dialogSettings = {
const dialogDynFilterSettings = {
title: i18n.getMessage("dialogDynFiltersChangeTitle"),
text: i18n.getMessage("dialogDynFiltersChangeNote"),
buttonYesText: i18n.getMessage("presetsWarningDialogYesButton"),
@ -700,12 +702,13 @@ TABS.motors.initialize = function (callback) {
}
};
if (FC.MOTOR_CONFIG.use_dshot_telemetry !== self.previousDshotBidir) { // if rpmFilterEnabled is not the same value as saved in the fc
GUI.showYesNoDialog(dialogSettings);
if ((FC.MOTOR_CONFIG.use_dshot_telemetry !== self.previousDshotBidir) && !(rpmFilterIsDisabled)) { // if rpmFilterEnabled is not the same value as saved in the fc
GUI.showYesNoDialog(dialogDynFilterSettings);
} else {
FC.FILTER_CONFIG.dyn_notch_count = self.previousFilterDynCount;
FC.FILTER_CONFIG.dyn_notch_q = self.previousFilterDynQ;
}
}
});
$('input[name="motorPoles"]').val(FC.MOTOR_CONFIG.motor_poles);

View file

@ -455,7 +455,8 @@ TABS.pid_tuning.initialize = function (callback) {
rpmFilterHarmonics_e.val(FILTER_DEFAULT.gyro_rpm_notch_harmonics);
}
const dialogSettings = {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
const dialogDynFilterSettings = {
title: i18n.getMessage("dialogDynFiltersChangeTitle"),
text: i18n.getMessage("dialogDynFiltersChangeNote"),
buttonYesText: i18n.getMessage("presetsWarningDialogYesButton"),
@ -475,11 +476,12 @@ TABS.pid_tuning.initialize = function (callback) {
};
if (checked !== (FC.FILTER_CONFIG.gyro_rpm_notch_harmonics !== 0)) { // if rpmFilterEnabled is not the same value as saved in the fc
GUI.showYesNoDialog(dialogSettings);
GUI.showYesNoDialog(dialogDynFilterSettings);
} else {
dynamicNotchCount_e.val(self.previousFilterDynCount);
dynamicNotchQ_e.val(self.previousFilterDynQ);
}
}
$('.rpmFilter span.suboption').toggle(checked);