1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 20:10:11 +03:00

Drop Global Functions support

This commit is contained in:
Pawel Spychalski (DzikuVx) 2020-07-23 11:33:35 +02:00
parent 752cd2360e
commit 0dcf1a9e58
7 changed files with 43 additions and 441 deletions

View file

@ -552,26 +552,6 @@ var mspHelper = (function (gui) {
console.log("Logic conditions saved");
break;
case MSPCodes.MSP2_INAV_GLOBAL_FUNCTIONS:
GLOBAL_FUNCTIONS.flush();
if (data.byteLength % 9 === 0) {
for (i = 0; i < data.byteLength; i += 9) {
GLOBAL_FUNCTIONS.put(new GlobalFunction(
data.getInt8(i),
data.getInt8(i + 1),
data.getInt8(i + 2),
data.getInt8(i + 3),
data.getInt32(i + 4, true),
data.getInt8(i + 8)
));
}
}
break;
case MSPCodes.MSP2_INAV_SET_GLOBAL_FUNCTIONS:
console.log("Global functions saved");
break;
case MSPCodes.MSP2_COMMON_MOTOR_MIXER:
MOTOR_RULES.flush();
@ -2380,48 +2360,6 @@ var mspHelper = (function (gui) {
}
};
self.loadGlobalFunctions = function (callback) {
MSP.send_message(MSPCodes.MSP2_INAV_GLOBAL_FUNCTIONS, false, false, callback);
}
self.sendGlobalFunctions = function (onCompleteCallback) {
let nextFunction = sendGlobalFunction,
functionIndex = 0;
if (GLOBAL_FUNCTIONS.getCount() == 0) {
onCompleteCallback();
} else {
nextFunction();
}
function sendGlobalFunction() {
let buffer = [];
// send one at a time, with index, 14 bytes per one condition
let globalFunction = GLOBAL_FUNCTIONS.get()[functionIndex];
buffer.push(functionIndex);
buffer.push(globalFunction.getEnabled());
buffer.push(globalFunction.getConditionId());
buffer.push(globalFunction.getAction());
buffer.push(globalFunction.getOperandType());
buffer.push(specificByte(globalFunction.getOperandValue(), 0));
buffer.push(specificByte(globalFunction.getOperandValue(), 1));
buffer.push(specificByte(globalFunction.getOperandValue(), 2));
buffer.push(specificByte(globalFunction.getOperandValue(), 3));
buffer.push(globalFunction.getFlags());
// prepare for next iteration
functionIndex++;
if (functionIndex == GLOBAL_FUNCTIONS.getCount()) { //This is the last rule. Not pretty, but we have to send all rules
nextFunction = onCompleteCallback;
}
MSP.send_message(MSPCodes.MSP2_INAV_SET_GLOBAL_FUNCTIONS, buffer, false, nextFunction);
}
};
self.sendModeRanges = function (onCompleteCallback) {
var nextFunction = send_next_mode_range;