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*/
|
||||
'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;
|
||||
};
|
||||
|
|
|
@ -510,10 +510,27 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
||||
LOGIC_CONDITIONS.flush();
|
||||
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),
|
||||
|
@ -523,6 +540,7 @@ var mspHelper = (function (gui) {
|
|||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS:
|
||||
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue