mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
Updated mixer
- Tidied up the code a little and grouped mixer types in model.js. - Removed second motor from all fixed wing mixers that aren't differential thrust. A bug was discovered that if an FC only has a single motor output, and 2 motors are set in the mixer, the motors won't work. - Added mixer for V-Tail with differential thrust - Enhanced the new servo button. Clicking it now selects the next available servo number, rather than just 0.
This commit is contained in:
parent
a31aa128f1
commit
47a9f4b36e
3 changed files with 184 additions and 140 deletions
275
js/model.js
275
js/model.js
|
@ -44,6 +44,7 @@ const
|
||||||
|
|
||||||
// generate mixer
|
// generate mixer
|
||||||
const mixerList = [
|
const mixerList = [
|
||||||
|
// ** Multirotor
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 'Tricopter',
|
name: 'Tricopter',
|
||||||
|
@ -104,17 +105,6 @@ const mixerList = [
|
||||||
motorMixer: [],
|
motorMixer: [],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 4
|
}, // 4
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: 'Gimbal',
|
|
||||||
model: 'custom',
|
|
||||||
image: 'custom',
|
|
||||||
enabled: false,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_OTHER,
|
|
||||||
motorMixer: [],
|
|
||||||
servoMixer: []
|
|
||||||
}, // 5
|
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
name: 'Y6',
|
name: 'Y6',
|
||||||
|
@ -151,44 +141,6 @@ const mixerList = [
|
||||||
],
|
],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 7
|
}, // 7
|
||||||
{
|
|
||||||
id: 8,
|
|
||||||
name: 'Flying Wing',
|
|
||||||
model: 'flying_wing',
|
|
||||||
image: 'flying_wing',
|
|
||||||
enabled: true,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_AIRPLANE,
|
|
||||||
motorMixer: [
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
|
||||||
],
|
|
||||||
servoMixer: [
|
|
||||||
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0),
|
|
||||||
]
|
|
||||||
}, // 8
|
|
||||||
{
|
|
||||||
id: 27,
|
|
||||||
name: 'Flying Wing with differential thrust',
|
|
||||||
model: 'flying_wing',
|
|
||||||
image: 'flying_wing',
|
|
||||||
enabled: true,
|
|
||||||
legacy: false,
|
|
||||||
platform: PLATFORM_AIRPLANE,
|
|
||||||
motorMixer: [
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, 0.1),
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, -0.1)
|
|
||||||
],
|
|
||||||
servoMixer: [
|
|
||||||
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0),
|
|
||||||
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0),
|
|
||||||
]
|
|
||||||
}, // 27
|
|
||||||
{
|
{
|
||||||
id: 9,
|
id: 9,
|
||||||
name: 'Y4',
|
name: 'Y4',
|
||||||
|
@ -283,50 +235,6 @@ const mixerList = [
|
||||||
],
|
],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 13
|
}, // 13
|
||||||
{
|
|
||||||
id: 14,
|
|
||||||
name: 'Airplane',
|
|
||||||
model: 'twin_plane',
|
|
||||||
image: 'airplane',
|
|
||||||
enabled: true,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_AIRPLANE,
|
|
||||||
hasFlaps: true,
|
|
||||||
motorMixer: [
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
|
||||||
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
|
||||||
],
|
|
||||||
servoMixer: [
|
|
||||||
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0),
|
|
||||||
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 100, 0),
|
|
||||||
/*new ServoMixRule(SERVO_FLAPPERON_1, INPUT_FEATURE_FLAPS, 100, 0),*/
|
|
||||||
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0),
|
|
||||||
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/
|
|
||||||
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
|
|
||||||
]
|
|
||||||
}, // 14
|
|
||||||
{
|
|
||||||
id: 15,
|
|
||||||
name: 'Heli 120',
|
|
||||||
model: 'custom',
|
|
||||||
image: 'custom',
|
|
||||||
enabled: false,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_HELICOPTER,
|
|
||||||
motorMixer: [],
|
|
||||||
servoMixer: []
|
|
||||||
}, // 15
|
|
||||||
{
|
|
||||||
id: 16,
|
|
||||||
name: 'Heli 90',
|
|
||||||
model: 'custom',
|
|
||||||
image: 'custom',
|
|
||||||
enabled: false,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_HELICOPTER,
|
|
||||||
motorMixer: [],
|
|
||||||
servoMixer: []
|
|
||||||
}, // 16
|
|
||||||
{
|
{
|
||||||
id: 17,
|
id: 17,
|
||||||
name: 'V-tail Quad',
|
name: 'V-tail Quad',
|
||||||
|
@ -361,17 +269,6 @@ const mixerList = [
|
||||||
],
|
],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 18
|
}, // 18
|
||||||
{
|
|
||||||
id: 19,
|
|
||||||
name: 'PPM to SERVO',
|
|
||||||
model: 'custom',
|
|
||||||
image: 'custom',
|
|
||||||
enabled: false,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_OTHER,
|
|
||||||
motorMixer: [],
|
|
||||||
servoMixer: []
|
|
||||||
}, // 19
|
|
||||||
{
|
{
|
||||||
id: 20,
|
id: 20,
|
||||||
name: 'Dualcopter',
|
name: 'Dualcopter',
|
||||||
|
@ -421,17 +318,6 @@ const mixerList = [
|
||||||
motorMixer: [],
|
motorMixer: [],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 23
|
}, // 23
|
||||||
{
|
|
||||||
id: 24,
|
|
||||||
name: 'Custom Airplane',
|
|
||||||
model: 'twin_plane',
|
|
||||||
image: 'airplane',
|
|
||||||
enabled: false,
|
|
||||||
legacy: true,
|
|
||||||
platform: PLATFORM_AIRPLANE,
|
|
||||||
motorMixer: [],
|
|
||||||
servoMixer: []
|
|
||||||
}, // 24
|
|
||||||
{
|
{
|
||||||
id: 25,
|
id: 25,
|
||||||
name: 'Custom Tricopter',
|
name: 'Custom Tricopter',
|
||||||
|
@ -443,6 +329,66 @@ const mixerList = [
|
||||||
motorMixer: [],
|
motorMixer: [],
|
||||||
servoMixer: []
|
servoMixer: []
|
||||||
}, // 25
|
}, // 25
|
||||||
|
|
||||||
|
// ** Fixed Wing **
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: 'Flying Wing',
|
||||||
|
model: 'flying_wing',
|
||||||
|
image: 'flying_wing',
|
||||||
|
enabled: true,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_AIRPLANE,
|
||||||
|
motorMixer: [
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
||||||
|
],
|
||||||
|
servoMixer: [
|
||||||
|
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0),
|
||||||
|
]
|
||||||
|
}, // 8
|
||||||
|
{
|
||||||
|
id: 27,
|
||||||
|
name: 'Flying Wing with differential thrust',
|
||||||
|
model: 'flying_wing',
|
||||||
|
image: 'flying_wing',
|
||||||
|
enabled: true,
|
||||||
|
legacy: false,
|
||||||
|
platform: PLATFORM_AIRPLANE,
|
||||||
|
motorMixer: [
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, 0.1),
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, -0.1)
|
||||||
|
],
|
||||||
|
servoMixer: [
|
||||||
|
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0),
|
||||||
|
new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0),
|
||||||
|
]
|
||||||
|
}, // 27
|
||||||
|
{
|
||||||
|
id: 14,
|
||||||
|
name: 'Airplane',
|
||||||
|
model: 'twin_plane',
|
||||||
|
image: 'airplane',
|
||||||
|
enabled: true,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_AIRPLANE,
|
||||||
|
hasFlaps: true,
|
||||||
|
motorMixer: [
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
|
||||||
|
],
|
||||||
|
servoMixer: [
|
||||||
|
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0),
|
||||||
|
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 100, 0),
|
||||||
|
/*new ServoMixRule(SERVO_FLAPPERON_1, INPUT_FEATURE_FLAPS, 100, 0),*/
|
||||||
|
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0),
|
||||||
|
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/
|
||||||
|
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
|
||||||
|
]
|
||||||
|
}, // 14
|
||||||
{
|
{
|
||||||
id: 26,
|
id: 26,
|
||||||
name: 'Airplane with differential thrust',
|
name: 'Airplane with differential thrust',
|
||||||
|
@ -464,10 +410,10 @@ const mixerList = [
|
||||||
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/
|
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/
|
||||||
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
|
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
|
||||||
]
|
]
|
||||||
},
|
}, // 26
|
||||||
{
|
{
|
||||||
id: 28,
|
id: 28,
|
||||||
name: 'Airplane V-tail (individual aileron servos)',
|
name: 'Airplane V-tail',
|
||||||
model: 'vtail_plane',
|
model: 'vtail_plane',
|
||||||
image: 'airplane_vtail',
|
image: 'airplane_vtail',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@ -487,7 +433,31 @@ const mixerList = [
|
||||||
new ServoMixRule(4, INPUT_STABILIZED_PITCH, -50, 0),
|
new ServoMixRule(4, INPUT_STABILIZED_PITCH, -50, 0),
|
||||||
new ServoMixRule(4, INPUT_STABILIZED_YAW, -50, 0)
|
new ServoMixRule(4, INPUT_STABILIZED_YAW, -50, 0)
|
||||||
]
|
]
|
||||||
},
|
}, // 28
|
||||||
|
{
|
||||||
|
id: 34,
|
||||||
|
name: 'Airplane V-tail with differential thrust',
|
||||||
|
model: 'vtail_plane',
|
||||||
|
image: 'airplane_vtail',
|
||||||
|
enabled: true,
|
||||||
|
legacy: false,
|
||||||
|
platform: PLATFORM_AIRPLANE,
|
||||||
|
hasFlaps: true,
|
||||||
|
motorMixer: [
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, 0.3),
|
||||||
|
new MotorMixRule(1.0, 0.0, 0.0, -0.3)
|
||||||
|
],
|
||||||
|
servoMixer: [
|
||||||
|
new ServoMixRule(1, INPUT_STABILIZED_ROLL, 100, 0),
|
||||||
|
/*new ServoMixRule(1, INPUT_FEATURE_FLAPS, 100, 0),*/
|
||||||
|
new ServoMixRule(2, INPUT_STABILIZED_ROLL, 100, 0),
|
||||||
|
/*new ServoMixRule(2, INPUT_FEATURE_FLAPS, 100, 0),*/
|
||||||
|
new ServoMixRule(3, INPUT_STABILIZED_PITCH, 50, 0),
|
||||||
|
new ServoMixRule(3, INPUT_STABILIZED_YAW, -50, 0),
|
||||||
|
new ServoMixRule(4, INPUT_STABILIZED_PITCH, -50, 0),
|
||||||
|
new ServoMixRule(4, INPUT_STABILIZED_YAW, -50, 0)
|
||||||
|
]
|
||||||
|
}, // 34
|
||||||
{
|
{
|
||||||
id: 29,
|
id: 29,
|
||||||
name: 'Airplane V-tail (single aileron servo)',
|
name: 'Airplane V-tail (single aileron servo)',
|
||||||
|
@ -506,7 +476,7 @@ const mixerList = [
|
||||||
new ServoMixRule(3, INPUT_STABILIZED_PITCH, -50, 0),
|
new ServoMixRule(3, INPUT_STABILIZED_PITCH, -50, 0),
|
||||||
new ServoMixRule(3, INPUT_STABILIZED_YAW, -50, 0),
|
new ServoMixRule(3, INPUT_STABILIZED_YAW, -50, 0),
|
||||||
]
|
]
|
||||||
},
|
}, //29
|
||||||
{
|
{
|
||||||
id: 30,
|
id: 30,
|
||||||
name: 'Airplane without rudder',
|
name: 'Airplane without rudder',
|
||||||
|
@ -526,7 +496,44 @@ const mixerList = [
|
||||||
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0),
|
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0),
|
||||||
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, 100, 0),*/
|
/*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, 100, 0),*/
|
||||||
]
|
]
|
||||||
},
|
}, // 30
|
||||||
|
{
|
||||||
|
id: 24,
|
||||||
|
name: 'Custom Airplane',
|
||||||
|
model: 'twin_plane',
|
||||||
|
image: 'airplane',
|
||||||
|
enabled: false,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_AIRPLANE,
|
||||||
|
motorMixer: [],
|
||||||
|
servoMixer: []
|
||||||
|
}, // 24
|
||||||
|
|
||||||
|
// ** Helicopter **
|
||||||
|
{
|
||||||
|
id: 15,
|
||||||
|
name: 'Heli 120',
|
||||||
|
model: 'custom',
|
||||||
|
image: 'custom',
|
||||||
|
enabled: false,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_HELICOPTER,
|
||||||
|
motorMixer: [],
|
||||||
|
servoMixer: []
|
||||||
|
}, // 15
|
||||||
|
{
|
||||||
|
id: 16,
|
||||||
|
name: 'Heli 90',
|
||||||
|
model: 'custom',
|
||||||
|
image: 'custom',
|
||||||
|
enabled: false,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_HELICOPTER,
|
||||||
|
motorMixer: [],
|
||||||
|
servoMixer: []
|
||||||
|
}, // 16
|
||||||
|
|
||||||
|
// ** Other platforms **
|
||||||
{
|
{
|
||||||
id: 31,
|
id: 31,
|
||||||
name: 'Rover',
|
name: 'Rover',
|
||||||
|
@ -556,8 +563,8 @@ const mixerList = [
|
||||||
servoMixer: [
|
servoMixer: [
|
||||||
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
|
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
,
|
// ** Misc **
|
||||||
{
|
{
|
||||||
id: 33,
|
id: 33,
|
||||||
name: 'Other',
|
name: 'Other',
|
||||||
|
@ -572,7 +579,29 @@ const mixerList = [
|
||||||
servoMixer: [
|
servoMixer: [
|
||||||
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
|
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: 'Gimbal',
|
||||||
|
model: 'custom',
|
||||||
|
image: 'custom',
|
||||||
|
enabled: false,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_OTHER,
|
||||||
|
motorMixer: [],
|
||||||
|
servoMixer: []
|
||||||
|
}, // 5
|
||||||
|
{
|
||||||
|
id: 19,
|
||||||
|
name: 'PPM to SERVO',
|
||||||
|
model: 'custom',
|
||||||
|
image: 'custom',
|
||||||
|
enabled: false,
|
||||||
|
legacy: true,
|
||||||
|
platform: PLATFORM_OTHER,
|
||||||
|
motorMixer: [],
|
||||||
|
servoMixer: []
|
||||||
|
}, // 19
|
||||||
];
|
];
|
||||||
|
|
||||||
const platformList = [
|
const platformList = [
|
||||||
|
|
|
@ -99,5 +99,20 @@ let ServoMixerRuleCollection = function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.getNextUnusedIndex = function() {
|
||||||
|
let nextTarget = 0;
|
||||||
|
|
||||||
|
for (let ruleIndex in data) {
|
||||||
|
if (data.hasOwnProperty(ruleIndex)) {
|
||||||
|
let target = data[ruleIndex].getTarget();
|
||||||
|
if (target > nextTarget) {
|
||||||
|
nextTarget = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextTarget+1;
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
|
@ -438,7 +438,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
$("[data-role='role-servo-add']").click(function () {
|
$("[data-role='role-servo-add']").click(function () {
|
||||||
if (SERVO_RULES.hasFreeSlots()) {
|
if (SERVO_RULES.hasFreeSlots()) {
|
||||||
SERVO_RULES.put(new ServoMixRule(0, 0, 100, 0));
|
SERVO_RULES.put(new ServoMixRule(SERVO_RULES.getNextUnusedIndex(), 0, 100, 0));
|
||||||
renderServoMixRules();
|
renderServoMixRules();
|
||||||
renderOutputMapping();
|
renderOutputMapping();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue