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

Switch to MSP2_INAV_SERVO_MIXER when possible

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-03-10 12:07:30 +01:00
parent fa3d57749f
commit 6306f53da6
3 changed files with 35 additions and 2 deletions

View file

@ -203,6 +203,11 @@ var MSPCodes = {
MSP2_INAV_SET_TEMP_SENSOR_CONFIG: 0x201D, MSP2_INAV_SET_TEMP_SENSOR_CONFIG: 0x201D,
MSP2_INAV_TEMPERATURES: 0x201E, 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_PID: 0x2030,
MSP2_SET_PID: 0x2031 MSP2_SET_PID: 0x2031
}; };

View file

@ -519,6 +519,22 @@ var mspHelper = (function (gui) {
} }
SERVO_RULES.cleanup(); 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; break;
case MSPCodes.MSP_SET_SERVO_MIX_RULE: case MSPCodes.MSP_SET_SERVO_MIX_RULE:
@ -3115,7 +3131,11 @@ var mspHelper = (function (gui) {
}; };
self.loadServoMixRules = function (callback) { self.loadServoMixRules = function (callback) {
MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, 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) { self.loadMotorMixRules = function (callback) {

View file

@ -1,7 +1,7 @@
/*global $*/ /*global $*/
'use strict'; 'use strict';
var ServoMixRule = function (target, input, rate, speed) { var ServoMixRule = function (target, input, rate, speed, condition) {
var self = {}; var self = {};
@ -41,5 +41,13 @@ var ServoMixRule = function (target, input, rate, speed) {
return rate !== 0; return rate !== 0;
}; };
self.getConditionId = function () {
return (condition == undefined) ? -1 : condition;
}
self.setConditionId = function (data) {
condition = data;
};
return self; return self;
}; };