call special params or pid advanced depending on the api version

10.3.x-maintenance
nathan 2016-07-30 01:15:46 -07:00
parent c138b7f39f
commit 00e89a1dae
2 changed files with 12 additions and 12 deletions

View File

@ -39,6 +39,7 @@ var FAILSAFE_CONFIG;
var RXFAIL_CONFIG;
var PID_ADVANCED_CONFIG;
var FILTER_CONFIG;
var SPECIAL_PARAMETERS;
var ADVANCED_TUNING;
var SENSOR_CONFIG;

View File

@ -694,28 +694,27 @@ TABS.pid_tuning.initialize = function (callback) {
PID.controller = pidController_e.val();
promise = MSP.promise(MSP_codes.MSP_SET_PID_CONTROLLER, MSP.crunch(MSP_codes.MSP_SET_PID_CONTROLLER));
}
return promise;
}).then(function () {
return MSP.promise(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID));
}).then(function () {
return MSP.promise(MSP_codes.MSP_SET_PID_ADVANCED, MSP.crunch(MSP_codes.MSP_SET_PID_ADVANCED));
}).then(function () {
var promise;
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
promise = MSP.promise(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG));
if (semver.gte(CONFIG.apiVersion, "2.9.0") && smver.lte(CONFIG.apiVersion, "3.0.0")) {
return MSP.promise(MSP_codes.MSP_SET_SPECIAL_PARAMETERS, MSP.crunch(MSP_codes.MSP_SET_SPECIAL_PARAMETERS));
}
}).then(function () {
if (semver.gte(CONFIG.apiVersion, "3.0.0")) {
return MSP.promise(MSP_codes.MSP_SET_PID_ADVANCED, MSP.crunch(MSP_codes.MSP_SET_PID_ADVANCED));
}
}).then(function () {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
return MSP.promise(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG));
}
return promise;
}).then(function () {
return MSP.promise(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING));
}).then(function () {
var promise;
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
promise = MSP.promise(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG));
return MSP.promise(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG));
}
return promise;
}).then(function () {
return MSP.promise(MSP_codes.MSP_EEPROM_WRITE);
}).then(function () {