mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
fix mixer_profie configurator issue
This commit is contained in:
parent
0435eb732b
commit
c41129b156
6 changed files with 75 additions and 14 deletions
|
@ -5,6 +5,7 @@ let ServoMixerRuleCollection = function () {
|
|||
|
||||
let self = {},
|
||||
data = [],
|
||||
inactiveData = [],
|
||||
maxServoCount = 16;
|
||||
|
||||
self.setServoCount = function (value) {
|
||||
|
@ -20,7 +21,11 @@ let ServoMixerRuleCollection = function () {
|
|||
}
|
||||
|
||||
self.put = function (element) {
|
||||
data.push(element);
|
||||
if (data.length < self.getServoRulesCount()) {
|
||||
data.push(element);
|
||||
}else{
|
||||
inactiveData.push(element); //store the data for mixer_profile 2
|
||||
}
|
||||
};
|
||||
|
||||
self.get = function () {
|
||||
|
@ -34,18 +39,24 @@ let ServoMixerRuleCollection = function () {
|
|||
|
||||
self.flush = function () {
|
||||
data = [];
|
||||
inactiveData = [];
|
||||
};
|
||||
|
||||
self.cleanup = function () {
|
||||
var tmpData = [];
|
||||
|
||||
var tmpInactiveData = [];
|
||||
data.forEach(function (element) {
|
||||
if (element.isUsed()) {
|
||||
tmpData.push(element);
|
||||
}
|
||||
});
|
||||
|
||||
inactiveData.forEach(function (element) {
|
||||
if (element.isUsed()) {
|
||||
tmpInactiveData.push(element);
|
||||
}
|
||||
});
|
||||
data = tmpData;
|
||||
inactiveData = tmpInactiveData;
|
||||
};
|
||||
|
||||
self.inflate = function () {
|
||||
|
@ -69,6 +80,15 @@ let ServoMixerRuleCollection = function () {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (let ruleIndex in inactiveData) {
|
||||
if (inactiveData.hasOwnProperty(ruleIndex)) {
|
||||
let rule = inactiveData[ruleIndex];
|
||||
|
||||
if (rule.getTarget() == servoId && rule.isUsed()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -106,6 +126,12 @@ let ServoMixerRuleCollection = function () {
|
|||
out.push(rule.getTarget());
|
||||
}
|
||||
}
|
||||
for (let ruleIndex in inactiveData) {
|
||||
if (inactiveData.hasOwnProperty(ruleIndex)) {
|
||||
let rule = inactiveData[ruleIndex];
|
||||
out.push(rule.getTarget());
|
||||
}
|
||||
}
|
||||
|
||||
let unique = [...new Set(out)];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue