|
|
@ -23,7 +23,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
mspHelper.loadMixerConfig,
|
|
|
|
mspHelper.loadMixerConfig,
|
|
|
|
mspHelper.loadMotors,
|
|
|
|
mspHelper.loadMotors,
|
|
|
|
mspHelper.loadServoMixRules,
|
|
|
|
mspHelper.loadServoMixRules,
|
|
|
|
mspHelper.loadMotorMixRules
|
|
|
|
mspHelper.loadMotorMixRules,
|
|
|
|
|
|
|
|
mspHelper.loadOutputMapping
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
loadChainer.setExitPoint(loadHtml);
|
|
|
|
loadChainer.setExitPoint(loadHtml);
|
|
|
|
loadChainer.execute();
|
|
|
|
loadChainer.execute();
|
|
|
@ -55,6 +56,58 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
$('#content').load("./tabs/mixer.html", processHtml);
|
|
|
|
$('#content').load("./tabs/mixer.html", processHtml);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderOutputTable() {
|
|
|
|
|
|
|
|
let outputCount = OUTPUT_MAPPING.getOutputCount(),
|
|
|
|
|
|
|
|
$outputRow = $('#output-row'),
|
|
|
|
|
|
|
|
$functionRow = $('#function-row');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$outputRow.append('<th data-i18n="mappingTableOutput"></th>');
|
|
|
|
|
|
|
|
$functionRow.append('<th data-i18n="mappingTableFunction"></th>');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 1; i <= outputCount; i++) {
|
|
|
|
|
|
|
|
$outputRow.append('<td>S' + i + '</td>');
|
|
|
|
|
|
|
|
$functionRow.append('<td id="function-' + i +'">-</td>');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$outputRow.find('td').css('width', 100 / (outputCount + 1) + '%');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderOutputMapping() {
|
|
|
|
|
|
|
|
let motorRules = MOTOR_RULES.get(),
|
|
|
|
|
|
|
|
servoRules = SERVO_RULES.get(),
|
|
|
|
|
|
|
|
output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let index in motorRules) {
|
|
|
|
|
|
|
|
if (motorRules.hasOwnProperty(index) && motorRules[index].isUsed()) {
|
|
|
|
|
|
|
|
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
|
|
|
|
|
|
|
output = OUTPUT_MAPPING.getMrMotorOutput(index);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
output = OUTPUT_MAPPING.getFwMotorOutput(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output !== null) {
|
|
|
|
|
|
|
|
$('#function-' + output).html("Motor " + index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let usedServoIndex = 0;
|
|
|
|
|
|
|
|
for (let i = 0; i < MIXER_CONFIG.numberOfServos; i++) {
|
|
|
|
|
|
|
|
if (SERVO_RULES.isServoConfigured(i)) {
|
|
|
|
|
|
|
|
console.log(i, usedServoIndex);
|
|
|
|
|
|
|
|
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
|
|
|
|
|
|
|
output = OUTPUT_MAPPING.getMrServoOutput(usedServoIndex);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
output = OUTPUT_MAPPING.getFwServoOutput(usedServoIndex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output !== null) {
|
|
|
|
|
|
|
|
$('#function-' + output).html("Servo " + i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
usedServoIndex++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function renderServoMixRules() {
|
|
|
|
function renderServoMixRules() {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Process servo mix table UI
|
|
|
|
* Process servo mix table UI
|
|
|
@ -258,6 +311,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
helper.mixer.loadMotorRules(currentMixerPreset);
|
|
|
|
helper.mixer.loadMotorRules(currentMixerPreset);
|
|
|
|
renderServoMixRules();
|
|
|
|
renderServoMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
modal.close();
|
|
|
|
modal.close();
|
|
|
|
saveAndReboot();
|
|
|
|
saveAndReboot();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -267,22 +321,26 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
helper.mixer.loadMotorRules(currentMixerPreset);
|
|
|
|
helper.mixer.loadMotorRules(currentMixerPreset);
|
|
|
|
renderServoMixRules();
|
|
|
|
renderServoMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$servoMixTableBody.on('click', "[data-role='role-servo-delete']", function (event) {
|
|
|
|
$servoMixTableBody.on('click', "[data-role='role-servo-delete']", function (event) {
|
|
|
|
SERVO_RULES.drop($(event.currentTarget).attr("data-index"));
|
|
|
|
SERVO_RULES.drop($(event.currentTarget).attr("data-index"));
|
|
|
|
renderServoMixRules();
|
|
|
|
renderServoMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$motorMixTableBody.on('click', "[data-role='role-motor-delete']", function (event) {
|
|
|
|
$motorMixTableBody.on('click', "[data-role='role-motor-delete']", function (event) {
|
|
|
|
MOTOR_RULES.drop($(event.currentTarget).attr("data-index"));
|
|
|
|
MOTOR_RULES.drop($(event.currentTarget).attr("data-index"));
|
|
|
|
renderMotorMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("[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(0, 0, 100, 0));
|
|
|
|
renderServoMixRules();
|
|
|
|
renderServoMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -290,6 +348,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
if (MOTOR_RULES.hasFreeSlots()) {
|
|
|
|
if (MOTOR_RULES.hasFreeSlots()) {
|
|
|
|
MOTOR_RULES.put(new MotorMixRule(1, 0, 0, 0));
|
|
|
|
MOTOR_RULES.put(new MotorMixRule(1, 0, 0, 0));
|
|
|
|
renderMotorMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -298,6 +357,9 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|
|
|
renderServoMixRules();
|
|
|
|
renderServoMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
renderMotorMixRules();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderOutputTable();
|
|
|
|
|
|
|
|
renderOutputMapping();
|
|
|
|
|
|
|
|
|
|
|
|
localize();
|
|
|
|
localize();
|
|
|
|
GUI.content_ready(callback);
|
|
|
|
GUI.content_ready(callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|