1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 12:55:13 +03:00

Fix some minor issues on mixer tab

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-12-09 17:55:33 +01:00
parent cf696de656
commit 4ebb8fb3ff
3 changed files with 22 additions and 3 deletions

View file

@ -53,7 +53,7 @@ let OutputMappingCollection = function () {
self.getOutputTable = function (isMR, motors, servos) {
let currentMotorIndex = 1,
currentServoIndex = 0,
timerMap = getTimerMap(isMR, motors, servos),
timerMap = getTimerMap(isMR, motors, servos.length),
outputMap = [],
offset = getFirstOutputOffset();
@ -67,7 +67,7 @@ let OutputMappingCollection = function () {
outputMap[i] = "Motor " + currentMotorIndex;
currentMotorIndex++;
} else if (assignment == OUTPUT_TYPE_SERVO) {
outputMap[i] = "Servo " + currentServoIndex;
outputMap[i] = "Servo " + servos[currentServoIndex];
currentServoIndex++;
}

View file

@ -82,5 +82,20 @@ let ServoMixerRuleCollection = function () {
return count;
};
self.getUsedServoIndexes = function () {
let out = [];
for (let ruleIndex in data) {
if (data.hasOwnProperty(ruleIndex)) {
let rule = data[ruleIndex];
out.push(rule.getTarget());
}
}
return jQuery.unique(out).sort(function(a, b){
return a-b;
});
}
return self;
};

View file

@ -78,7 +78,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
let outputMap = OUTPUT_MAPPING.getOutputTable(
MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER,
MOTOR_RULES.getNumberOfConfiguredMotors(),
SERVO_RULES.getNumberOfConfiguredServos()
SERVO_RULES.getUsedServoIndexes()
);
for (let i = 1; i <= OUTPUT_MAPPING.getOutputCount(); i++) {
@ -334,6 +334,10 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
renderOutputMapping();
});
$servoMixTableBody.on('change', "input", function (event) {
renderOutputMapping();
});
$("[data-role='role-servo-add']").click(function () {
if (SERVO_RULES.hasFreeSlots()) {
SERVO_RULES.put(new ServoMixRule(0, 0, 100, 0));