mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
ground work for mmix editing
This commit is contained in:
parent
385827a66f
commit
bb8507e81b
6 changed files with 112 additions and 4 deletions
49
js/servoMixerRuleCollection.js
Normal file
49
js/servoMixerRuleCollection.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*global $, ServoMixRule*/
|
||||
'use strict';
|
||||
|
||||
var ServoMixerRuleCollection = function () {
|
||||
|
||||
var self = {};
|
||||
var data = [];
|
||||
|
||||
self.put = function (element) {
|
||||
data.push(element);
|
||||
};
|
||||
|
||||
self.get = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
self.drop = function (index) {
|
||||
data[index].setRate(0);
|
||||
self.cleanup();
|
||||
};
|
||||
|
||||
self.flush = function () {
|
||||
data = [];
|
||||
};
|
||||
|
||||
self.cleanup = function () {
|
||||
var tmpData = [];
|
||||
|
||||
data.forEach(function (element) {
|
||||
if (element.isUsed()) {
|
||||
tmpData.push(element);
|
||||
}
|
||||
});
|
||||
|
||||
data = tmpData;
|
||||
};
|
||||
|
||||
self.inflate = function () {
|
||||
while (self.hasFreeSlots()) {
|
||||
self.put(new ServoMixRule(0, 0, 0, 0));
|
||||
}
|
||||
};
|
||||
|
||||
self.hasFreeSlots = function () {
|
||||
return data.length < 16;
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue