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
diff options
context:
space:
mode:
authorPaweł Spychalski <pspychalski@gmail.com>2022-08-14 12:03:24 +0300
committerGitHub <noreply@github.com>2022-08-14 12:03:24 +0300
commit64f81158c05ad3a3d12961a9ddc81de3ec59616a (patch)
tree9355c7916634b460a69c4091e05c289177fdc543
parent88db2005f3fa81873c0addae5892f5084d8c9a97 (diff)
parentdaa70fc4b1c3b46b4886f299623eaf74477c9b1f (diff)
Merge pull request #1603 from iNavFlight/MrD_Fix-number-of-logic-conditions-visible
Fixed and enhanced LC display
-rw-r--r--js/fc.js2
-rw-r--r--js/gui.js15
-rw-r--r--js/logicCondition.js3
-rw-r--r--js/logicConditionsCollection.js4
-rw-r--r--main.css4
-rw-r--r--tabs/mixer.js1
-rw-r--r--tabs/programming.js1
7 files changed, 25 insertions, 5 deletions
diff --git a/js/fc.js b/js/fc.js
index 5ad7275a..4c862d39 100644
--- a/js/fc.js
+++ b/js/fc.js
@@ -1249,7 +1249,7 @@ var FC = {
4: {
name: "Logic Condition",
type: "range",
- range: [0, 31],
+ range: [0, (LOGIC_CONDITIONS.getMaxLogicConditionCount()-1)],
default: 0
},
5: {
diff --git a/js/gui.js b/js/gui.js
index 301abf71..b60b6d6e 100644
--- a/js/gui.js
+++ b/js/gui.js
@@ -300,16 +300,27 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata
* @param {function} onChange
* @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"),
lcCount = logicConditions.getCount();
+ option = "";
if (withAlways) {
$select.append('<option value="-1">Always</option>')
}
for (let i = 0; i < lcCount ; i++) {
- $select.append('<option value="' + i + '">Logic Condition ' + i + ' </option>');
+ if (!onlyEnabled || i === current || (logicConditions.isEnabled(i))) {
+ option = '<option';
+
+ if (i === current && !logicConditions.isEnabled(i)) {
+ option+= ' class="lc_disabled"';
+ }
+
+ option+= ' value="' + i + '">Logic Condition ' + i + ' </option>';
+
+ $select.append(option);
+ }
}
$select.val(current).change(onChange);
diff --git a/js/logicCondition.js b/js/logicCondition.js
index e5a5de3e..8409476b 100644
--- a/js/logicCondition.js
+++ b/js/logicCondition.js
@@ -218,9 +218,10 @@ let LogicCondition = function (enabled, activatorId, operation, operandAType, op
if (self.getEnabled()) {
GUI.renderLogicConditionSelect(
$e,
- LOGIC_CONDITIONS,
+ LOGIC_CONDITIONS,
self.getActivatorId,
self.onActivatorChange,
+ true,
true
);
} else {
diff --git a/js/logicConditionsCollection.js b/js/logicConditionsCollection.js
index 84ccc8ce..9412362c 100644
--- a/js/logicConditionsCollection.js
+++ b/js/logicConditionsCollection.js
@@ -28,6 +28,10 @@ let LogicConditionsCollection = function () {
return data.length
};
+ self.isEnabled = function (lcID) {
+ return data[lcID].getEnabled();
+ }
+
self.open = function () {
self.render();
$container.show();
diff --git a/main.css b/main.css
index 1c13dbf8..f2e47013 100644
--- a/main.css
+++ b/main.css
@@ -2010,6 +2010,10 @@ select {
padding: 1px;
}
+.lc_disabled {
+ color: #aaa;
+}
+
.ic_osd {
background-image: url("../images/icons/icon_osd.svg");
background-position-y: 4px;
diff --git a/tabs/mixer.js b/tabs/mixer.js
index 85462cec..660dc6b8 100644
--- a/tabs/mixer.js
+++ b/tabs/mixer.js
@@ -295,6 +295,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
function () {
servoRule.setConditionId($(this).val());
},
+ true,
true
);
diff --git a/tabs/programming.js b/tabs/programming.js
index 6c22c85b..8114b913 100644
--- a/tabs/programming.js
+++ b/tabs/programming.js
@@ -40,7 +40,6 @@ TABS.programming.initialize = function (callback, scrollPosition) {
}
function processHtml() {
-
LOGIC_CONDITIONS.init($('#subtab-lc'));
LOGIC_CONDITIONS.render();