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>2020-04-12 00:37:40 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-04-12 00:37:40 +0300
commit305927eb046cd0157ced12baf1bdf0f35221ba9a (patch)
treecc4bbae2c2309c99867e4c6b58a0c62493fb8e96 /js
parent583e73ef223ce99f32f9ea91b67bf015a02b4517 (diff)
MSP layer for LC Activator
Diffstat (limited to 'js')
-rw-r--r--js/logicCondition.js10
-rw-r--r--js/msp/MSPHelper.js43
2 files changed, 41 insertions, 12 deletions
diff --git a/js/logicCondition.js b/js/logicCondition.js
index 76e8ca62..c1fc3a81 100644
--- a/js/logicCondition.js
+++ b/js/logicCondition.js
@@ -1,7 +1,7 @@
/*global $,FC*/
'use strict';
-let LogicCondition = function (enabled, operation, operandAType, operandAValue, operandBType, operandBValue, flags) {
+let LogicCondition = function (enabled, activatorId, operation, operandAType, operandAValue, operandBType, operandBValue, flags) {
let self = {};
let $row;
@@ -13,6 +13,14 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
enabled = !!data;
};
+ self.getActivatorId = function () {
+ return activatorId;
+ };
+
+ self.setActivatorId = function (data) {
+ activatorId = data;
+ };
+
self.getOperation = function () {
return operation;
};
diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js
index d19d9bc7..37c95592 100644
--- a/js/msp/MSPHelper.js
+++ b/js/msp/MSPHelper.js
@@ -510,17 +510,35 @@ var mspHelper = (function (gui) {
break;
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
LOGIC_CONDITIONS.flush();
- if (data.byteLength % 13 === 0) {
- for (i = 0; i < data.byteLength; i += 13) {
- LOGIC_CONDITIONS.put(new LogicCondition(
- data.getInt8(i),
- data.getInt8(i + 1),
- data.getInt8(i + 2),
- data.getInt32(i + 3, true),
- data.getInt8(i + 7),
- data.getInt32(i + 8, true),
- data.getInt8(i + 12)
- ));
+ if (semver.gte(CONFIG.flightControllerVersion, "2.5.0")) {
+ if (data.byteLength % 14 === 0) {
+ for (i = 0; i < data.byteLength; i += 14) {
+ LOGIC_CONDITIONS.put(new LogicCondition(
+ data.getInt8(i),
+ data.getInt8(i + 1),
+ data.getInt8(i + 2),
+ data.getInt8(i + 3),
+ data.getInt32(i + 4, true),
+ data.getInt8(i + 8),
+ data.getInt32(i + 9, true),
+ data.getInt8(i + 13)
+ ));
+ }
+ }
+ } else {
+ if (data.byteLength % 13 === 0) {
+ for (i = 0; i < data.byteLength; i += 13) {
+ LOGIC_CONDITIONS.put(new LogicCondition(
+ data.getInt8(i),
+ -1,
+ data.getInt8(i + 1),
+ data.getInt8(i + 2),
+ data.getInt32(i + 3, true),
+ data.getInt8(i + 7),
+ data.getInt32(i + 8, true),
+ data.getInt8(i + 12)
+ ));
+ }
}
}
break;
@@ -2400,6 +2418,9 @@ var mspHelper = (function (gui) {
buffer.push(conditionIndex);
buffer.push(condition.getEnabled());
+ if (semver.gte(CONFIG.flightControllerVersion, "2.5.0")) {
+ buffer.push(condition.getActivatorId());
+ }
buffer.push(condition.getOperation());
buffer.push(condition.getOperandAType());
buffer.push(specificByte(condition.getOperandAValue(), 0));