1
0
Fork 0
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:
Pawel Spychalski (DzikuVx) 2020-04-11 18:11:17 +02:00
parent b193ea3aa6
commit 583e73ef22
6 changed files with 82 additions and 31 deletions

View file

@ -3143,6 +3143,9 @@
"logicFlags": { "logicFlags": {
"message": "Flags" "message": "Flags"
}, },
"logicStatus": {
"message": "Status"
},
"logicSave": { "logicSave": {
"message": "Save" "message": "Save"
}, },

View file

@ -1020,87 +1020,108 @@ var FC = {
return { return {
0: { 0: {
name: "True", name: "True",
hasOperand: [false, false] hasOperand: [false, false],
output: "boolean"
}, },
1: { 1: {
name: "Equal", name: "Equal",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
2: { 2: {
name: "Greater Than", name: "Greater Than",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
3: { 3: {
name: "Lower Than", name: "Lower Than",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
4: { 4: {
name: "Low", name: "Low",
hasOperand: [true, false] hasOperand: [true, false],
output: "boolean"
}, },
5: { 5: {
name: "Mid", name: "Mid",
hasOperand: [true, false] hasOperand: [true, false],
output: "boolean"
}, },
6: { 6: {
name: "High", name: "High",
hasOperand: [true, false] hasOperand: [true, false],
output: "boolean"
}, },
7: { 7: {
name: "AND", name: "AND",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
8: { 8: {
name: "OR", name: "OR",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
9: { 9: {
name: "XOR", name: "XOR",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
10: { 10: {
name: "NAND", name: "NAND",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
11: { 11: {
name: "NOR", name: "NOR",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
12: { 12: {
name: "NOT", name: "NOT",
hasOperand: [true, false] hasOperand: [true, false],
output: "boolean"
}, },
13: { 13: {
name: "STICKY", name: "STICKY",
hasOperand: [true, true] hasOperand: [true, true],
output: "boolean"
}, },
14: { 14: {
name: "ADD", name: "ADD",
hasOperand: [true, true] hasOperand: [true, true],
output: "raw"
}, },
15: { 15: {
name: "SUB", name: "SUB",
hasOperand: [true, true] hasOperand: [true, true],
output: "raw"
}, },
16: { 16: {
name: "MUL", name: "MUL",
hasOperand: [true, true] hasOperand: [true, true],
output: "raw"
}, },
17: { 17: {
name: "DIV", name: "DIV",
hasOperand: [true, true] hasOperand: [true, true],
output: "raw"
}, },
18: { 18: {
name: "GVAR SET", name: "GVAR SET",
hasOperand: [true, true] hasOperand: [true, true],
output: "none"
}, },
19: { 19: {
name: "GVAR INC", name: "GVAR INC",
hasOperand: [true, true] hasOperand: [true, true],
output: "none"
}, },
20: { 20: {
name: "GVAR DEC", name: "GVAR DEC",
hasOperand: [true, true] hasOperand: [true, true],
output: "none"
} }
} }
}, },

View file

@ -64,6 +64,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
self.onEnabledChange = function (event) { self.onEnabledChange = function (event) {
let $cT = $(event.currentTarget); let $cT = $(event.currentTarget);
self.setEnabled(!!$cT.prop('checked')); self.setEnabled(!!$cT.prop('checked'));
self.renderStatus();
}; };
self.getOperatorMetadata = function () { self.getOperatorMetadata = function () {
@ -84,6 +85,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
self.setOperandBValue(0); self.setOperandBValue(0);
self.renderOperand(0); self.renderOperand(0);
self.renderOperand(1); self.renderOperand(1);
self.renderStatus();
}; };
self.onOperatorTypeChange = function (event) { self.onOperatorTypeChange = function (event) {
@ -158,19 +160,40 @@ 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) { self.update = function (index, value, $container) {
if (typeof $row === 'undefined') { if (typeof $row === 'undefined') {
return; return;
} }
let $marker = $row.find('.logic_cell__active_marker');
if (!!value) { let displayType = FC.getLogicOperators()[self.getOperation()].output,
$marker.addClass("logic_cell__active_marker--active"); $marker;
$marker.removeClass("logic_cell__active_marker--inactive");
} else { if (self.getEnabled() && displayType == "boolean") {
$marker.removeClass("logic_cell__active_marker--active"); $marker = $row.find('.logic_cell__active_marker');
$marker.addClass("logic_cell__active_marker--inactive");
if (!!value) {
$marker.addClass("logic_cell__active_marker--active");
$marker.removeClass("logic_cell__active_marker--inactive");
} else {
$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);
} }
} }
@ -182,7 +205,8 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
<td class="logic_cell__operation"></td>\ <td class="logic_cell__operation"></td>\
<td class="logic_cell__operandA"></td>\ <td class="logic_cell__operandA"></td>\
<td class="logic_cell__operandB"></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>\ </tr>\
'); ');
@ -214,6 +238,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
self.renderOperand(0); self.renderOperand(0);
self.renderOperand(1); self.renderOperand(1);
self.renderStatus();
} }
return self; return self;

View file

@ -138,6 +138,7 @@
<th data-i18n="logicOperandA"></th> <th data-i18n="logicOperandA"></th>
<th data-i18n="logicOperandB"></th> <th data-i18n="logicOperandB"></th>
<th data-i18n="logicFlags"></th> <th data-i18n="logicFlags"></th>
<th data-i18n="logicStatus"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -44,6 +44,7 @@
<th data-i18n="logicOperandA"></th> <th data-i18n="logicOperandA"></th>
<th data-i18n="logicOperandB"></th> <th data-i18n="logicOperandB"></th>
<th style="width: 40px" data-i18n="logicFlags"></th> <th style="width: 40px" data-i18n="logicFlags"></th>
<th style="width: 50px" data-i18n="logicStatus"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -52,7 +52,7 @@ TABS.programming.initialize = function (callback, scrollPosition) {
}); });
if (semver.gte(CONFIG.flightControllerVersion, "2.3.0")) { 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(); statusChainer.execute();
}); });
} }