From 00e89a1daee582372671550c156f8957f3a538d0 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 30 Jul 2016 01:15:46 -0700 Subject: [PATCH] call special params or pid advanced depending on the api version --- js/fc.js | 1 + tabs/pid_tuning.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/fc.js b/js/fc.js index aca02975..66c1761d 100644 --- a/js/fc.js +++ b/js/fc.js @@ -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; diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 6b857307..0d79a3bd 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -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 () {