1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 20:35:19 +03:00

Fixed and enhanced LC display

This commit is contained in:
Darren Lines 2022-08-13 19:40:38 +01:00
parent 386c23f8a4
commit b8485457dd
6 changed files with 12 additions and 5 deletions

View file

@ -1249,7 +1249,7 @@ var FC = {
4: { 4: {
name: "Logic Condition", name: "Logic Condition",
type: "range", type: "range",
range: [0, 31], range: [0, (LOGIC_CONDITIONS.getMaxLogicConditionCount()-1)],
default: 0 default: 0
}, },
5: { 5: {

View file

@ -300,7 +300,7 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata
* @param {function} onChange * @param {function} onChange
* @param {boolean} withAlways * @param {boolean} withAlways
*/ */
GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways) { GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways, onlyEnabled) {
let $select = $container.append('<select class="mix-rule-condition">').find("select"), let $select = $container.append('<select class="mix-rule-condition">').find("select"),
lcCount = logicConditions.getCount(); lcCount = logicConditions.getCount();
@ -309,8 +309,10 @@ GUI_control.prototype.renderLogicConditionSelect = function ($container, logicCo
$select.append('<option value="-1">Always</option>') $select.append('<option value="-1">Always</option>')
} }
for (let i = 0; i < lcCount ; i++) { for (let i = 0; i < lcCount ; i++) {
if (!onlyEnabled || (logicConditions.isEnabled(i))) {
$select.append('<option value="' + i + '">Logic Condition ' + i + ' </option>'); $select.append('<option value="' + i + '">Logic Condition ' + i + ' </option>');
} }
}
$select.val(current).change(onChange); $select.val(current).change(onChange);
} }

View file

@ -221,6 +221,7 @@ let LogicCondition = function (enabled, activatorId, operation, operandAType, op
LOGIC_CONDITIONS, LOGIC_CONDITIONS,
self.getActivatorId, self.getActivatorId,
self.onActivatorChange, self.onActivatorChange,
true,
true true
); );
} else { } else {

View file

@ -28,6 +28,10 @@ let LogicConditionsCollection = function () {
return data.length return data.length
}; };
self.isEnabled = function (lcID) {
return data[lcID].getEnabled();
}
self.open = function () { self.open = function () {
self.render(); self.render();
$container.show(); $container.show();

View file

@ -295,6 +295,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
function () { function () {
servoRule.setConditionId($(this).val()); servoRule.setConditionId($(this).val());
}, },
true,
true true
); );

View file

@ -40,7 +40,6 @@ TABS.programming.initialize = function (callback, scrollPosition) {
} }
function processHtml() { function processHtml() {
LOGIC_CONDITIONS.init($('#subtab-lc')); LOGIC_CONDITIONS.init($('#subtab-lc'));
LOGIC_CONDITIONS.render(); LOGIC_CONDITIONS.render();