Merge pull request #157 from mikeller/fix_controller

Fixed PID controller selection.
10.3.x-maintenance
Michael Keller 2016-07-29 15:28:00 +12:00 committed by GitHub
commit 9467a3c0eb
1 changed files with 10 additions and 9 deletions

View File

@ -687,15 +687,16 @@ TABS.pid_tuning.initialize = function (callback) {
$('a.update').click(function () {
form_to_pid_and_rc();
Promise.resolve(function () {
var promise;
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
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 () {
var promise;
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
PID.controller = pidController_e.val();
promise = MSP.promise(MSP_codes.MSP_SET_PID_CONTROLLER, MSP.crunch(MSP_codes.MSP_SET_PID_CONTROLLER));
} else {
promise = new Promise(function (resolve) {
resolve();
});
}
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));