mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Some changes required for the 'custom-servo-mixers' cleanflight branch.
TODO - Support old version of MSP_SERVO_CONF
This commit is contained in:
parent
8d39b3f8cc
commit
438dc8d46d
2 changed files with 42 additions and 26 deletions
47
js/model.js
47
js/model.js
|
@ -2,27 +2,28 @@
|
||||||
|
|
||||||
// generate mixer
|
// generate mixer
|
||||||
var mixerList = [
|
var mixerList = [
|
||||||
{name: 'Tricopter', model: 'tricopter', image: 'tri'},
|
{name: 'Tricopter', model: 'tricopter', image: 'tri'},
|
||||||
{name: 'Quad +', model: 'quad_x', image: 'quad_p'},
|
{name: 'Quad +', model: 'quad_x', image: 'quad_p'},
|
||||||
{name: 'Quad X', model: 'quad_x', image: 'quad_x'},
|
{name: 'Quad X', model: 'quad_x', image: 'quad_x'},
|
||||||
{name: 'Bicopter', model: 'custom', image: 'bicopter'},
|
{name: 'Bicopter', model: 'custom', image: 'bicopter'},
|
||||||
{name: 'Gimbal', model: 'custom', image: 'custom'},
|
{name: 'Gimbal', model: 'custom', image: 'custom'},
|
||||||
{name: 'Y6', model: 'y6', image: 'y6'},
|
{name: 'Y6', model: 'y6', image: 'y6'},
|
||||||
{name: 'Hex +', model: 'hex_plus', image: 'hex_p'},
|
{name: 'Hex +', model: 'hex_plus', image: 'hex_p'},
|
||||||
{name: 'Flying Wing', model: 'custom', image: 'flying_wing'},
|
{name: 'Flying Wing', model: 'custom', image: 'flying_wing'},
|
||||||
{name: 'Y4', model: 'y4', image: 'y4'},
|
{name: 'Y4', model: 'y4', image: 'y4'},
|
||||||
{name: 'Hex X', model: 'hex_x', image: 'hex_x'},
|
{name: 'Hex X', model: 'hex_x', image: 'hex_x'},
|
||||||
{name: 'Octo X8', model: 'custom', image: 'octo_x8'},
|
{name: 'Octo X8', model: 'custom', image: 'octo_x8'},
|
||||||
{name: 'Octo Flat +', model: 'custom', image: 'octo_flat_p'},
|
{name: 'Octo Flat +', model: 'custom', image: 'octo_flat_p'},
|
||||||
{name: 'Octo Flat X', model: 'custom', image: 'octo_flat_x'},
|
{name: 'Octo Flat X', model: 'custom', image: 'octo_flat_x'},
|
||||||
{name: 'Airplane', model: 'custom', image: 'airplane'},
|
{name: 'Airplane', model: 'custom', image: 'airplane'},
|
||||||
{name: 'Heli 120', model: 'custom', image: 'custom'},
|
{name: 'Heli 120', model: 'custom', image: 'custom'},
|
||||||
{name: 'Heli 90', model: 'custom', image: 'custom'},
|
{name: 'Heli 90', model: 'custom', image: 'custom'},
|
||||||
{name: 'V-tail Quad', model: 'quad_vtail', image: 'vtail_quad'},
|
{name: 'V-tail Quad', model: 'quad_vtail', image: 'vtail_quad'},
|
||||||
{name: 'Hex H', model: 'custom', image: 'custom'},
|
{name: 'Hex H', model: 'custom', image: 'custom'},
|
||||||
{name: 'PPM to SERVO', model: 'custom', image: 'custom'},
|
{name: 'PPM to SERVO', model: 'custom', image: 'custom'},
|
||||||
{name: 'Dualcopter', model: 'custom', image: 'custom'},
|
{name: 'Dualcopter', model: 'custom', image: 'custom'},
|
||||||
{name: 'Singlecopter', model: 'custom', image: 'custom'},
|
{name: 'Singlecopter', model: 'custom', image: 'custom'},
|
||||||
{name: 'A-tail Quad', model: 'quad_atail', image: 'atail_quad'},
|
{name: 'A-tail Quad', model: 'quad_atail', image: 'atail_quad'},
|
||||||
{name: 'Custom', model: 'custom', image: 'custom'}
|
{name: 'Custom', model: 'custom', image: 'custom'},
|
||||||
|
{name: 'Custom Airplane', model: 'custom', image: 'custom'}
|
||||||
];
|
];
|
||||||
|
|
21
js/msp.js
21
js/msp.js
|
@ -447,13 +447,16 @@ var MSP = {
|
||||||
case MSP_codes.MSP_SERVO_CONF:
|
case MSP_codes.MSP_SERVO_CONF:
|
||||||
SERVO_CONFIG = []; // empty the array as new data is coming in
|
SERVO_CONFIG = []; // empty the array as new data is coming in
|
||||||
|
|
||||||
if (data.byteLength % 7 == 0) {
|
if (data.byteLength % 13 == 0) {
|
||||||
for (var i = 0; i < data.byteLength; i += 7) {
|
for (var i = 0; i < data.byteLength; i += 13) {
|
||||||
var arr = {
|
var arr = {
|
||||||
'min': data.getInt16(i, 1),
|
'min': data.getInt16(i, 1),
|
||||||
'max': data.getInt16(i + 2, 1),
|
'max': data.getInt16(i + 2, 1),
|
||||||
'middle': data.getInt16(i + 4, 1),
|
'middle': data.getInt16(i + 4, 1),
|
||||||
'rate': data.getInt8(i + 6)
|
'rate': data.getInt8(i + 6),
|
||||||
|
'angleAtMin': data.getInt8(i + 7),
|
||||||
|
'angleAtMax': data.getInt8(i + 8),
|
||||||
|
'reversedChannels': data.getInt32(i + 9)
|
||||||
};
|
};
|
||||||
|
|
||||||
SERVO_CONFIG.push(arr);
|
SERVO_CONFIG.push(arr);
|
||||||
|
@ -1047,6 +1050,18 @@ MSP.crunch = function (code) {
|
||||||
buffer.push(highByte(SERVO_CONFIG[i].middle));
|
buffer.push(highByte(SERVO_CONFIG[i].middle));
|
||||||
|
|
||||||
buffer.push(lowByte(SERVO_CONFIG[i].rate));
|
buffer.push(lowByte(SERVO_CONFIG[i].rate));
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.11.0")) {
|
||||||
|
buffer.push(SERVO_CONFIG[i].angleAtMin);
|
||||||
|
buffer.push(SERVO_CONFIG[i].angleAtMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.12.0")) {
|
||||||
|
buffer.push(specificByte(SERVO_CONFIG[i].reversedChannels, 0));
|
||||||
|
buffer.push(specificByte(SERVO_CONFIG[i].reversedChannels, 1));
|
||||||
|
buffer.push(specificByte(SERVO_CONFIG[i].reversedChannels, 2));
|
||||||
|
buffer.push(specificByte(SERVO_CONFIG[i].reversedChannels, 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_SET_CHANNEL_FORWARDING:
|
case MSP_codes.MSP_SET_CHANNEL_FORWARDING:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue