mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +03:00
Store logic condition with smix rule
This commit is contained in:
parent
57f7035ef0
commit
564d1cdca5
4 changed files with 51 additions and 17 deletions
|
@ -2964,5 +2964,8 @@
|
|||
},
|
||||
"logicClose": {
|
||||
"message": "Close"
|
||||
},
|
||||
"active": {
|
||||
"message": "Active"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -539,7 +539,9 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP_SET_SERVO_MIX_RULE:
|
||||
console.log("Servo mix saved");
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_SET_SERVO_MIXER:
|
||||
console.log("Servo mix saved");
|
||||
break;
|
||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
||||
LOGIC_CONDITIONS.flush();
|
||||
if (data.byteLength % 13 === 0) {
|
||||
|
@ -2280,6 +2282,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
var servoRule = SERVO_RULES.get()[servoIndex];
|
||||
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "2.2.0")) {
|
||||
buffer.push(servoIndex);
|
||||
buffer.push(servoRule.getTarget());
|
||||
buffer.push(servoRule.getInput());
|
||||
|
@ -2300,6 +2303,23 @@ var mspHelper = (function (gui) {
|
|||
nextFunction = onCompleteCallback;
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP_SET_SERVO_MIX_RULE, buffer, false, nextFunction);
|
||||
} else {
|
||||
//INAV 2.2 uses different MSP frame
|
||||
buffer.push(servoIndex);
|
||||
buffer.push(servoRule.getTarget());
|
||||
buffer.push(servoRule.getInput());
|
||||
buffer.push(lowByte(servoRule.getRate()));
|
||||
buffer.push(highByte(servoRule.getRate()));
|
||||
buffer.push(servoRule.getSpeed());
|
||||
buffer.push(servoRule.getConditionId());
|
||||
|
||||
// prepare for next iteration
|
||||
servoIndex++;
|
||||
if (servoIndex == SERVO_RULES.getServoRulesCount()) { //This is the last rule. Not pretty, but we have to send all rules
|
||||
nextFunction = onCompleteCallback;
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SET_SERVO_MIXER, buffer, false, nextFunction);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
<th data-i18n="input"></th>
|
||||
<th data-i18n="weight"></th>
|
||||
<th data-i18n="speed"></th>
|
||||
<th data-i18n="active"></th>
|
||||
<th class="delete"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -124,11 +124,21 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
<td><select class="mix-rule-input"></select></td>\
|
||||
<td><input type="number" class="mix-rule-rate" step="1" min="-125" max="125" /></td>\
|
||||
<td><input type="number" class="mix-rule-speed" step="1" min="0" max="255" /></td>\
|
||||
<td><select class="mix-rule-condition"></td>\
|
||||
<td><span class="btn default_btn narrow red"><a href="#" data-role="role-servo-delete" data-i18n="servoMixerDelete"></a></span></td>\
|
||||
</tr>\
|
||||
');
|
||||
|
||||
const $row = $servoMixTableBody.find('tr:last');
|
||||
const $conditions = $row.find('.mix-rule-condition');
|
||||
|
||||
$conditions.append('<option value="-1">Always</option>')
|
||||
for (let i = 0; i < 16 ; i++) {
|
||||
$conditions.append('<option value="' + i + '">Logic Condition ' + i + ' </option>');
|
||||
}
|
||||
$conditions.val(servoRule.getConditionId()).change(function () {
|
||||
servoRule.setConditionId($(this).val());
|
||||
});
|
||||
|
||||
GUI.fillSelect($row.find(".mix-rule-input"), FC.getServoMixInputNames(), servoRule.getInput());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue