Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2019-03-10 14:07:30 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2019-03-10 14:07:30 +0300
commit6306f53da64e731218fcf6708b375f6f228b6f11 (patch)
treeb75cd72106d5a0bdcd90c1f7bcfd93b7f18173a7 /js
parentfa3d57749fe7761577bbba1b0941c0224011f7e8 (diff)
Switch to MSP2_INAV_SERVO_MIXER when possible
Diffstat (limited to 'js')
-rw-r--r--js/msp/MSPCodes.js5
-rw-r--r--js/msp/MSPHelper.js22
-rw-r--r--js/servoMixRule.js10
3 files changed, 35 insertions, 2 deletions
diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js
index 40f8f234..9308719b 100644
--- a/js/msp/MSPCodes.js
+++ b/js/msp/MSPCodes.js
@@ -203,6 +203,11 @@ var MSPCodes = {
MSP2_INAV_SET_TEMP_SENSOR_CONFIG: 0x201D,
MSP2_INAV_TEMPERATURES: 0x201E,
+ MSP2_INAV_SERVO_MIXER: 0x2020,
+ MSP2_INAV_SET_SERVO_MIXER: 0x2021,
+ MSP2_INAV_LOGIC_CONDITIONS: 0x2022,
+ MSP2_INAV_SET_LOGIC_CONDITIONS: 0x2023,
+
MSP2_PID: 0x2030,
MSP2_SET_PID: 0x2031
};
diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js
index 8f2b7f4d..8ce043e8 100644
--- a/js/msp/MSPHelper.js
+++ b/js/msp/MSPHelper.js
@@ -520,6 +520,22 @@ var mspHelper = (function (gui) {
SERVO_RULES.cleanup();
break;
+ case MSPCodes.MSP2_INAV_SERVO_MIXER:
+ SERVO_RULES.flush();
+ if (data.byteLength % 6 === 0) {
+ for (i = 0; i < data.byteLength; i += 6) {
+ SERVO_RULES.put(new ServoMixRule(
+ data.getInt8(i),
+ data.getInt8(i + 1),
+ data.getInt16(i + 2, true),
+ data.getInt8(i + 4),
+ data.getInt8(i + 5)
+ ));
+ }
+ }
+ SERVO_RULES.cleanup();
+
+ break;
case MSPCodes.MSP_SET_SERVO_MIX_RULE:
console.log("Servo mix saved");
@@ -3115,7 +3131,11 @@ var mspHelper = (function (gui) {
};
self.loadServoMixRules = function (callback) {
- MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, callback);
+ if (semver.gte(CONFIG.flightControllerVersion, "2.2.0")) {
+ MSP.send_message(MSPCodes.MSP2_INAV_SERVO_MIXER, false, false, callback);
+ } else {
+ MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, callback);
+ }
};
self.loadMotorMixRules = function (callback) {
diff --git a/js/servoMixRule.js b/js/servoMixRule.js
index 03c3c0e5..a2de27fe 100644
--- a/js/servoMixRule.js
+++ b/js/servoMixRule.js
@@ -1,7 +1,7 @@
/*global $*/
'use strict';
-var ServoMixRule = function (target, input, rate, speed) {
+var ServoMixRule = function (target, input, rate, speed, condition) {
var self = {};
@@ -41,5 +41,13 @@ var ServoMixRule = function (target, input, rate, speed) {
return rate !== 0;
};
+ self.getConditionId = function () {
+ return (condition == undefined) ? -1 : condition;
+ }
+
+ self.setConditionId = function (data) {
+ condition = data;
+ };
+
return self;
}; \ No newline at end of file