mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 04:45:18 +03:00
Switch to MSP2_INAV_SERVO_MIXER when possible
This commit is contained in:
parent
fa3d57749f
commit
6306f53da6
3 changed files with 35 additions and 2 deletions
|
@ -203,6 +203,11 @@ var MSPCodes = {
|
|||
MSP2_INAV_SET_TEMP_SENSOR_CONFIG: 0x201D,
|
||||
MSP2_INAV_TEMPERATURES: 0x201E,
|
||||
|
||||
MSP2_INAV_SERVO_MIXER: 0x2020,
|
||||
MSP2_INAV_SET_SERVO_MIXER: 0x2021,
|
||||
MSP2_INAV_LOGIC_CONDITIONS: 0x2022,
|
||||
MSP2_INAV_SET_LOGIC_CONDITIONS: 0x2023,
|
||||
|
||||
MSP2_PID: 0x2030,
|
||||
MSP2_SET_PID: 0x2031
|
||||
};
|
||||
|
|
|
@ -519,6 +519,22 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
SERVO_RULES.cleanup();
|
||||
|
||||
break;
|
||||
case MSPCodes.MSP2_INAV_SERVO_MIXER:
|
||||
SERVO_RULES.flush();
|
||||
if (data.byteLength % 6 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 6) {
|
||||
SERVO_RULES.put(new ServoMixRule(
|
||||
data.getInt8(i),
|
||||
data.getInt8(i + 1),
|
||||
data.getInt16(i + 2, true),
|
||||
data.getInt8(i + 4),
|
||||
data.getInt8(i + 5)
|
||||
));
|
||||
}
|
||||
}
|
||||
SERVO_RULES.cleanup();
|
||||
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_SERVO_MIX_RULE:
|
||||
|
@ -3115,7 +3131,11 @@ var mspHelper = (function (gui) {
|
|||
};
|
||||
|
||||
self.loadServoMixRules = function (callback) {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.2.0")) {
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SERVO_MIXER, false, false, callback);
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, callback);
|
||||
}
|
||||
};
|
||||
|
||||
self.loadMotorMixRules = function (callback) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*global $*/
|
||||
'use strict';
|
||||
|
||||
var ServoMixRule = function (target, input, rate, speed) {
|
||||
var ServoMixRule = function (target, input, rate, speed, condition) {
|
||||
|
||||
var self = {};
|
||||
|
||||
|
@ -41,5 +41,13 @@ var ServoMixRule = function (target, input, rate, speed) {
|
|||
return rate !== 0;
|
||||
};
|
||||
|
||||
self.getConditionId = function () {
|
||||
return (condition == undefined) ? -1 : condition;
|
||||
}
|
||||
|
||||
self.setConditionId = function (data) {
|
||||
condition = data;
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue