mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 08:45:26 +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 @@ var MotorMixerRuleCollection = function () {
|
|||
|
||||
let self = {},
|
||||
data = [],
|
||||
inactiveData = [],
|
||||
maxMotorCount = 8;
|
||||
|
||||
self.setMotorCount = function (value) {
|
||||
|
@ -16,7 +17,11 @@ var MotorMixerRuleCollection = function () {
|
|||
};
|
||||
|
||||
self.put = function (element) {
|
||||
data.push(element);
|
||||
if (data.length < self.getMotorCount()){
|
||||
data.push(element);
|
||||
}else{
|
||||
inactiveData.push(element); //store the data for mixer_profile 2
|
||||
}
|
||||
};
|
||||
|
||||
self.get = function () {
|
||||
|
@ -30,18 +35,25 @@ var MotorMixerRuleCollection = 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 () {
|
||||
|
@ -55,7 +67,7 @@ var MotorMixerRuleCollection = function () {
|
|||
};
|
||||
|
||||
self.getNumberOfConfiguredMotors = function () {
|
||||
return data.length;
|
||||
return data.length > inactiveData.length ? data.length : inactiveData.length;
|
||||
};
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue