Skip to content

Commit

Permalink
fix slider warnings for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mituritsyn committed Sep 22, 2024
1 parent d417c75 commit bad319a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/TuningSliders.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import MSP from "./msp";
import FC from "./fc";
import MSPCodes from "./msp/MSPCodes";
import semver from 'semver';
import { API_VERSION_1_47 } from "./data_storage";
import { isExpertModeEnabled } from "./utils/isExportModeEnabled";
import { mspHelper } from "./msp/MSPHelper";
import $ from 'jquery';
Expand Down Expand Up @@ -244,7 +246,9 @@ TuningSliders.updateSlidersWarning = function(slidersUnavailable = false) {
const WARNING_D_MAX_GAIN = 60;
const WARNING_I_GAIN = 2.5 * FC.PIDS[0][0];
const WARNING_D_GAIN = 42;
const enableWarning = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_MAX_GAIN;
const enableWarning = semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47)
? FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_MAX_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_GAIN
: FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_MAX_GAIN;

$('.subtab-pid .slidersWarning').toggle(enableWarning && !slidersUnavailable);
};
Expand Down

0 comments on commit bad319a

Please sign in to comment.