Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-04-11 19:11:17 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-04-11 19:11:17 +0300
commit583e73ef223ce99f32f9ea91b67bf015a02b4517 (patch)
treefc14661a5d91e1e67a5c97d7ab54c7981dbf23a2 /js
parentb193ea3aa618c0735867b6e63968f3f14647a241 (diff)
Improve LC status indication
Diffstat (limited to 'js')
-rw-r--r--js/fc.js63
-rw-r--r--js/logicCondition.js43
2 files changed, 76 insertions, 30 deletions
diff --git a/js/fc.js b/js/fc.js
index 6bb82a44..e61f954f 100644
--- a/js/fc.js
+++ b/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"
}
}
},
diff --git a/js/logicCondition.js b/js/logicCondition.js
index c95c86f7..76e8ca62 100644
--- a/js/logicCondition.js
+++ b/js/logicCondition.js
@@ -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,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) {
if (typeof $row === 'undefined') {
return;
}
-
- let $marker = $row.find('.logic_cell__active_marker');
- 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");
+ 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");
+ $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__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;