mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-23 00:05:19 +03:00
MSP layer for LC Activator
This commit is contained in:
parent
583e73ef22
commit
305927eb04
2 changed files with 41 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*global $,FC*/
|
/*global $,FC*/
|
||||||
'use strict';
|
'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 self = {};
|
||||||
let $row;
|
let $row;
|
||||||
|
|
||||||
|
@ -13,6 +13,14 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
||||||
enabled = !!data;
|
enabled = !!data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getActivatorId = function () {
|
||||||
|
return activatorId;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setActivatorId = function (data) {
|
||||||
|
activatorId = data;
|
||||||
|
};
|
||||||
|
|
||||||
self.getOperation = function () {
|
self.getOperation = function () {
|
||||||
return operation;
|
return operation;
|
||||||
};
|
};
|
||||||
|
|
|
@ -510,17 +510,35 @@ var mspHelper = (function (gui) {
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
||||||
LOGIC_CONDITIONS.flush();
|
LOGIC_CONDITIONS.flush();
|
||||||
if (data.byteLength % 13 === 0) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.5.0")) {
|
||||||
for (i = 0; i < data.byteLength; i += 13) {
|
if (data.byteLength % 14 === 0) {
|
||||||
LOGIC_CONDITIONS.put(new LogicCondition(
|
for (i = 0; i < data.byteLength; i += 14) {
|
||||||
data.getInt8(i),
|
LOGIC_CONDITIONS.put(new LogicCondition(
|
||||||
data.getInt8(i + 1),
|
data.getInt8(i),
|
||||||
data.getInt8(i + 2),
|
data.getInt8(i + 1),
|
||||||
data.getInt32(i + 3, true),
|
data.getInt8(i + 2),
|
||||||
data.getInt8(i + 7),
|
data.getInt8(i + 3),
|
||||||
data.getInt32(i + 8, true),
|
data.getInt32(i + 4, true),
|
||||||
data.getInt8(i + 12)
|
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;
|
break;
|
||||||
|
@ -2400,6 +2418,9 @@ var mspHelper = (function (gui) {
|
||||||
|
|
||||||
buffer.push(conditionIndex);
|
buffer.push(conditionIndex);
|
||||||
buffer.push(condition.getEnabled());
|
buffer.push(condition.getEnabled());
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "2.5.0")) {
|
||||||
|
buffer.push(condition.getActivatorId());
|
||||||
|
}
|
||||||
buffer.push(condition.getOperation());
|
buffer.push(condition.getOperation());
|
||||||
buffer.push(condition.getOperandAType());
|
buffer.push(condition.getOperandAType());
|
||||||
buffer.push(specificByte(condition.getOperandAValue(), 0));
|
buffer.push(specificByte(condition.getOperandAValue(), 0));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue