diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 47448912..ad4395fa 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -4397,6 +4397,9 @@ "no_waypoints_to_save": { "message": "No waypoints to save !" }, + "mixerThrottleWarning": { + "message": "Warning:value beyond normal operation range." + }, "servoMixer": { "message": "Servo mixer" }, diff --git a/js/motorMixRule.js b/js/motorMixRule.js index 16b241e1..06957821 100644 --- a/js/motorMixRule.js +++ b/js/motorMixRule.js @@ -6,7 +6,7 @@ var MotorMixRule = function (throttle, roll, pitch, yaw) { var self = {}; self.fromMsp = function (mspThrottle, mspRoll, mspPitch, mspYaw) { - throttle = mspThrottle / 1000; + throttle = Math.round(((mspThrottle / 1000) - 2) * 1000) / 1000; roll = Math.round(((mspRoll / 1000) - 2) * 1000) / 1000; pitch = Math.round(((mspPitch / 1000) - 2) * 1000) / 1000; yaw = Math.round(((mspYaw / 1000) - 2) * 1000) / 1000; @@ -17,11 +17,11 @@ var MotorMixRule = function (throttle, roll, pitch, yaw) { }; self.getThrottle = function () { - return constrain(parseFloat(throttle, 10), 0, 1); + return constrain(parseFloat(throttle, 10), -2, 2); }; self.getThrottleForMsp = function () { - return self.getThrottle() * 1000; + return (self.getThrottle()+2) * 1000; }; self.setThrottle = function (data) { diff --git a/js/motorMixerRuleCollection.js b/js/motorMixerRuleCollection.js index 6a5a6c40..a995f867 100644 --- a/js/motorMixerRuleCollection.js +++ b/js/motorMixerRuleCollection.js @@ -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; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index a4254e97..b0e3a8c5 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1454,7 +1454,7 @@ var mspHelper = (function (gui) { case MSPCodes.MSP2_INAV_MIXER: MIXER_CONFIG.yawMotorDirection = data.getInt8(0); MIXER_CONFIG.yawJumpPreventionLimit = data.getUint8(1, true); - MIXER_CONFIG.motorStopOnLow = data.getUint8(2, true); + MIXER_CONFIG.motorStopOnLow = data.getUint8(1, true); MIXER_CONFIG.platformType = data.getInt8(3); MIXER_CONFIG.hasFlaps = data.getInt8(4); MIXER_CONFIG.appliedMixerPreset = data.getInt16(5, true); diff --git a/js/servoMixerRuleCollection.js b/js/servoMixerRuleCollection.js index 8c3399a2..e595668d 100644 --- a/js/servoMixerRuleCollection.js +++ b/js/servoMixerRuleCollection.js @@ -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)]; diff --git a/tabs/mixer.js b/tabs/mixer.js index 331d1475..815e9197 100644 --- a/tabs/mixer.js +++ b/tabs/mixer.js @@ -435,7 +435,10 @@ TABS.mixer.initialize = function (callback, scrollPosition) { $motorMixTableBody.append('\