mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
Improve LC status indication
This commit is contained in:
parent
b193ea3aa6
commit
583e73ef22
6 changed files with 82 additions and 31 deletions
|
@ -3143,6 +3143,9 @@
|
|||
"logicFlags": {
|
||||
"message": "Flags"
|
||||
},
|
||||
"logicStatus": {
|
||||
"message": "Status"
|
||||
},
|
||||
"logicSave": {
|
||||
"message": "Save"
|
||||
},
|
||||
|
|
63
js/fc.js
63
js/fc.js
|
@ -1020,87 +1020,108 @@ var FC = {
|
|||
return {
|
||||
0: {
|
||||
name: "True",
|
||||
hasOperand: [false, false]
|
||||
hasOperand: [false, false],
|
||||
output: "boolean"
|
||||
},
|
||||
1: {
|
||||
name: "Equal",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
2: {
|
||||
name: "Greater Than",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
3: {
|
||||
name: "Lower Than",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
4: {
|
||||
name: "Low",
|
||||
hasOperand: [true, false]
|
||||
hasOperand: [true, false],
|
||||
output: "boolean"
|
||||
},
|
||||
5: {
|
||||
name: "Mid",
|
||||
hasOperand: [true, false]
|
||||
hasOperand: [true, false],
|
||||
output: "boolean"
|
||||
},
|
||||
6: {
|
||||
name: "High",
|
||||
hasOperand: [true, false]
|
||||
hasOperand: [true, false],
|
||||
output: "boolean"
|
||||
},
|
||||
7: {
|
||||
name: "AND",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
8: {
|
||||
name: "OR",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
9: {
|
||||
name: "XOR",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
10: {
|
||||
name: "NAND",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
11: {
|
||||
name: "NOR",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
12: {
|
||||
name: "NOT",
|
||||
hasOperand: [true, false]
|
||||
hasOperand: [true, false],
|
||||
output: "boolean"
|
||||
},
|
||||
13: {
|
||||
name: "STICKY",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "boolean"
|
||||
},
|
||||
14: {
|
||||
name: "ADD",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "raw"
|
||||
},
|
||||
15: {
|
||||
name: "SUB",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "raw"
|
||||
},
|
||||
16: {
|
||||
name: "MUL",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "raw"
|
||||
},
|
||||
17: {
|
||||
name: "DIV",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "raw"
|
||||
},
|
||||
18: {
|
||||
name: "GVAR SET",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "none"
|
||||
},
|
||||
19: {
|
||||
name: "GVAR INC",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "none"
|
||||
},
|
||||
20: {
|
||||
name: "GVAR DEC",
|
||||
hasOperand: [true, true]
|
||||
hasOperand: [true, true],
|
||||
output: "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -64,6 +64,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
self.onEnabledChange = function (event) {
|
||||
let $cT = $(event.currentTarget);
|
||||
self.setEnabled(!!$cT.prop('checked'));
|
||||
self.renderStatus();
|
||||
};
|
||||
|
||||
self.getOperatorMetadata = function () {
|
||||
|
@ -84,6 +85,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
self.setOperandBValue(0);
|
||||
self.renderOperand(0);
|
||||
self.renderOperand(1);
|
||||
self.renderStatus();
|
||||
};
|
||||
|
||||
self.onOperatorTypeChange = function (event) {
|
||||
|
@ -158,12 +160,29 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
}
|
||||
}
|
||||
|
||||
self.renderStatus = function () {
|
||||
let $e = $row.find('.logic_cell__status'),
|
||||
displayType = FC.getLogicOperators()[self.getOperation()].output;
|
||||
|
||||
if (self.getEnabled() && displayType == "boolean") {
|
||||
$e.html('<div class="logic_cell__active_marker"></div>');
|
||||
} else if (self.getEnabled() && displayType == "raw") {
|
||||
$e.html('<div class="logic_cell__raw_value"></div>');
|
||||
} else {
|
||||
$e.html('');
|
||||
}
|
||||
}
|
||||
|
||||
self.update = function (index, value, $container) {
|
||||
if (typeof $row === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let $marker = $row.find('.logic_cell__active_marker');
|
||||
let displayType = FC.getLogicOperators()[self.getOperation()].output,
|
||||
$marker;
|
||||
|
||||
if (self.getEnabled() && displayType == "boolean") {
|
||||
$marker = $row.find('.logic_cell__active_marker');
|
||||
|
||||
if (!!value) {
|
||||
$marker.addClass("logic_cell__active_marker--active");
|
||||
|
@ -172,6 +191,10 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
$marker.removeClass("logic_cell__active_marker--active");
|
||||
$marker.addClass("logic_cell__active_marker--inactive");
|
||||
}
|
||||
} else if (self.getEnabled() && displayType == "raw") {
|
||||
$marker = $row.find('.logic_cell__raw_value');
|
||||
$marker.html(value);
|
||||
}
|
||||
}
|
||||
|
||||
self.render = function (index, $container) {
|
||||
|
@ -182,7 +205,8 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
<td class="logic_cell__operation"></td>\
|
||||
<td class="logic_cell__operandA"></td>\
|
||||
<td class="logic_cell__operandB"></td>\
|
||||
<td class="logic_cell__flags"><div class="logic_cell__active_marker"></div></td>\
|
||||
<td class="logic_cell__flags"></div></td>\
|
||||
<td class="logic_cell__status"></td>\
|
||||
</tr>\
|
||||
');
|
||||
|
||||
|
@ -214,6 +238,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
|
||||
self.renderOperand(0);
|
||||
self.renderOperand(1);
|
||||
self.renderStatus();
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
<th data-i18n="logicOperandA"></th>
|
||||
<th data-i18n="logicOperandB"></th>
|
||||
<th data-i18n="logicFlags"></th>
|
||||
<th data-i18n="logicStatus"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<th data-i18n="logicOperandA"></th>
|
||||
<th data-i18n="logicOperandB"></th>
|
||||
<th style="width: 40px" data-i18n="logicFlags"></th>
|
||||
<th style="width: 50px" data-i18n="logicStatus"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -52,7 +52,7 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
});
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.3.0")) {
|
||||
helper.mspBalancedInterval.add('logic_conditions_pull', 350, 1, function () {
|
||||
helper.mspBalancedInterval.add('logic_conditions_pull', 100, 1, function () {
|
||||
statusChainer.execute();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue