Unverified Commit 4f5a7ca7 authored by Dylan Jones's avatar Dylan Jones
Browse files

Fully add support for extra mixer columns

parent ef7273a6
......@@ -1939,6 +1939,12 @@
"controlAxisThrottle": {
"message": "Throttle [T]"
},
"controlAxisForward": {
"message": "Forward [F]"
},
"controlAxisLateral": {
"message": "Lateral [L]"
},
"radioChannelShort": {
"message": "CH "
},
......
......@@ -25,6 +25,8 @@ var MotorMixerRuleCollection = function () {
self.drop = function (index) {
data[index].setThrottle(0);
data[index].setForward(0);
data[index].setLateral(0);
self.cleanup();
};
......
......@@ -574,8 +574,8 @@ var mspHelper = (function (gui) {
case MSPCodes.MSP2_COMMON_MOTOR_MIXER:
MOTOR_RULES.flush();
if (data.byteLength % 8 === 0) {
for (i = 0; i < data.byteLength; i += 8) {
if (data.byteLength % 12 === 0) {
for (i = 0; i < data.byteLength; i += 12) {
var rule = new MotorMixRule(0, 0, 0, 0, 0, 0);
rule.fromMsp(
......@@ -590,6 +590,7 @@ var mspHelper = (function (gui) {
MOTOR_RULES.put(rule);
}
}
console.log(MOTOR_RULES)
MOTOR_RULES.cleanup();
break;
......@@ -2329,6 +2330,12 @@ var mspHelper = (function (gui) {
buffer.push(lowByte(rule.getThrottleForMsp()));
buffer.push(highByte(rule.getThrottleForMsp()));
buffer.push(lowByte(rule.getForwardForMsp()));
buffer.push(highByte(rule.getForwardForMsp()));
buffer.push(lowByte(rule.getLateralForMsp()));
buffer.push(highByte(rule.getLateralForMsp()));
buffer.push(lowByte(rule.getRollForMsp()));
buffer.push(highByte(rule.getRollForMsp()));
......
......@@ -82,6 +82,8 @@
<tr>
<th style="width: 75px">Motor</th>
<th data-i18n="controlAxisThrottle"></th>
<th data-i18n="controlAxisForward"></th>
<th data-i18n="controlAxisLateral"></th>
<th data-i18n="controlAxisRoll"></th>
<th data-i18n="controlAxisPitch"></th>
<th data-i18n="controlAxisYaw"></th>
......
......@@ -204,6 +204,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
<tr>\
<td><span class="mix-rule-motor"></span></td>\
<td><input type="number" class="mix-rule-throttle" step="0.001" min="0" max="1" /></td>\
<td><input type="number" class="mix-rule-forward" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-lateral" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-roll" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-pitch" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-yaw" step="0.001" min="-2" max="2" /></td>\
......@@ -214,16 +216,22 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
const $row = $motorMixTableBody.find('tr:last');
$row.find('.mix-rule-motor').html(index);
$row.find('.mix-rule-throttle').val(rule.getThrottle()).change(function () {
$row.find('.mix-rule-throttle').val(rule.getThrottle().toFixed(3)).change(function () {
rule.setThrottle($(this).val());
});
$row.find('.mix-rule-roll').val(rule.getRoll()).change(function () {
$row.find('.mix-rule-forward').val(rule.getForward().toFixed(3)).change(function () {
rule.setForward($(this).val());
});
$row.find('.mix-rule-lateral').val(rule.getLateral().toFixed(3)).change(function () {
rule.setLateral($(this).val());
});
$row.find('.mix-rule-roll').val(rule.getRoll().toFixed(3)).change(function () {
rule.setRoll($(this).val());
});
$row.find('.mix-rule-pitch').val(rule.getPitch()).change(function () {
$row.find('.mix-rule-pitch').val(rule.getPitch().toFixed(3)).change(function () {
rule.setPitch($(this).val());
});
$row.find('.mix-rule-yaw').val(rule.getYaw()).change(function () {
$row.find('.mix-rule-yaw').val(rule.getYaw().toFixed(3)).change(function () {
rule.setYaw($(this).val());
});
$row.find("[data-role='role-motor-delete']").attr("data-index", i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment