1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 04:15:28 +03:00

BLE, TCP and UDP Support

This commit is contained in:
Andi Kanzler 2022-03-31 16:18:46 +02:00
parent 1322fd69bd
commit ab7162980b
24 changed files with 1190 additions and 387 deletions

View file

@ -463,22 +463,33 @@ var mspHelper = (function (gui) {
console.log("Servo mix saved");
break;
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
LOGIC_CONDITIONS.flush();
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.getUint8(i + 2),
data.getUint8(i + 3),
data.getInt32(i + 4, true),
data.getUint8(i + 8),
data.getInt32(i + 9, true),
data.getInt8(i + 13)
));
if (semver.gte(CONFIG.flightControllerVersion, "5.0.0")) {
LOGIC_CONDITIONS.put(new LogicCondition(
data.getInt8(0),
data.getInt8(1),
data.getUint8(2),
data.getUint8(3),
data.getInt32(4, true),
data.getUint8(8),
data.getInt32(9, true),
data.getInt8(13)
));
} else {
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.getUint8(i + 2),
data.getUint8(i + 3),
data.getInt32(i + 4, true),
data.getUint8(i + 8),
data.getInt32(i + 9, true),
data.getInt8(i + 13)
));
}
}
}
break;
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS:
@ -2259,7 +2270,23 @@ var mspHelper = (function (gui) {
};
self.loadLogicConditions = function (callback) {
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS, false, false, callback);
LOGIC_CONDITIONS.flush();
if (semver.gte(CONFIG.flightControllerVersion, "5.0.0")) {
let idx = 0;
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS, [idx], false, nextLogicCondition);
function nextLogicCondition() {
idx++;
if (idx < LOGIC_CONDITIONS.getMaxLogicConditionCount() - 1) {
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS, [idx], false, nextLogicCondition);
} else {
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS, [idx], false, callback);
}
}
} else {
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS, false, false, callback);
}
}
self.sendLogicConditions = function (onCompleteCallback) {
@ -3228,5 +3255,6 @@ var mspHelper = (function (gui) {
MSP.send_message(MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS, false, false, callback);
};
return self;
})(GUI);