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": {
|
"logicClose": {
|
||||||
"message": "Close"
|
"message": "Close"
|
||||||
|
},
|
||||||
|
"active": {
|
||||||
|
"message": "Active"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,7 +539,9 @@ var mspHelper = (function (gui) {
|
||||||
case MSPCodes.MSP_SET_SERVO_MIX_RULE:
|
case MSPCodes.MSP_SET_SERVO_MIX_RULE:
|
||||||
console.log("Servo mix saved");
|
console.log("Servo mix saved");
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP2_INAV_SET_SERVO_MIXER:
|
||||||
|
console.log("Servo mix saved");
|
||||||
|
break;
|
||||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
||||||
LOGIC_CONDITIONS.flush();
|
LOGIC_CONDITIONS.flush();
|
||||||
if (data.byteLength % 13 === 0) {
|
if (data.byteLength % 13 === 0) {
|
||||||
|
@ -2280,26 +2282,44 @@ var mspHelper = (function (gui) {
|
||||||
|
|
||||||
var servoRule = SERVO_RULES.get()[servoIndex];
|
var servoRule = SERVO_RULES.get()[servoIndex];
|
||||||
|
|
||||||
buffer.push(servoIndex);
|
if (semver.lt(CONFIG.flightControllerVersion, "2.2.0")) {
|
||||||
buffer.push(servoRule.getTarget());
|
buffer.push(servoIndex);
|
||||||
buffer.push(servoRule.getInput());
|
buffer.push(servoRule.getTarget());
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.1.0")) {
|
buffer.push(servoRule.getInput());
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "2.1.0")) {
|
||||||
|
buffer.push(lowByte(servoRule.getRate()));
|
||||||
|
buffer.push(highByte(servoRule.getRate()));
|
||||||
|
} else {
|
||||||
|
buffer.push(servoRule.getRate());
|
||||||
|
}
|
||||||
|
buffer.push(servoRule.getSpeed());
|
||||||
|
buffer.push(0);
|
||||||
|
buffer.push(0);
|
||||||
|
buffer.push(0);
|
||||||
|
|
||||||
|
// 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.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(lowByte(servoRule.getRate()));
|
||||||
buffer.push(highByte(servoRule.getRate()));
|
buffer.push(highByte(servoRule.getRate()));
|
||||||
} else {
|
buffer.push(servoRule.getSpeed());
|
||||||
buffer.push(servoRule.getRate());
|
buffer.push(servoRule.getConditionId());
|
||||||
}
|
|
||||||
buffer.push(servoRule.getSpeed());
|
|
||||||
buffer.push(0);
|
|
||||||
buffer.push(0);
|
|
||||||
buffer.push(0);
|
|
||||||
|
|
||||||
// prepare for next iteration
|
// prepare for next iteration
|
||||||
servoIndex++;
|
servoIndex++;
|
||||||
if (servoIndex == SERVO_RULES.getServoRulesCount()) { //This is the last rule. Not pretty, but we have to send all rules
|
if (servoIndex == SERVO_RULES.getServoRulesCount()) { //This is the last rule. Not pretty, but we have to send all rules
|
||||||
nextFunction = onCompleteCallback;
|
nextFunction = onCompleteCallback;
|
||||||
|
}
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SET_SERVO_MIXER, buffer, false, nextFunction);
|
||||||
}
|
}
|
||||||
MSP.send_message(MSPCodes.MSP_SET_SERVO_MIX_RULE, buffer, false, nextFunction);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@
|
||||||
<th data-i18n="input"></th>
|
<th data-i18n="input"></th>
|
||||||
<th data-i18n="weight"></th>
|
<th data-i18n="weight"></th>
|
||||||
<th data-i18n="speed"></th>
|
<th data-i18n="speed"></th>
|
||||||
|
<th data-i18n="active"></th>
|
||||||
<th class="delete"></th>
|
<th class="delete"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -124,11 +124,21 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
<td><select class="mix-rule-input"></select></td>\
|
<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-rate" step="1" min="-125" max="125" /></td>\
|
||||||
<td><input type="number" class="mix-rule-speed" step="1" min="0" max="255" /></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>\
|
<td><span class="btn default_btn narrow red"><a href="#" data-role="role-servo-delete" data-i18n="servoMixerDelete"></a></span></td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
');
|
');
|
||||||
|
|
||||||
const $row = $servoMixTableBody.find('tr:last');
|
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());
|
GUI.fillSelect($row.find(".mix-rule-input"), FC.getServoMixInputNames(), servoRule.getInput());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue