mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
initial take at configurable FEATURE_3D
completely untested and may attempt to kill you when enabled. no binary. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@360 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
e010e3a354
commit
3afeb3d1c8
6 changed files with 53 additions and 11 deletions
33
src/mixer.c
33
src/mixer.c
|
@ -166,6 +166,17 @@ void mixerInit(void)
|
|||
currentMixer[i] = mixers[mcfg.mixerConfiguration].motor[i];
|
||||
}
|
||||
}
|
||||
|
||||
// in 3D mode, mixer gain has to be halved
|
||||
if (feature(FEATURE_3D)) {
|
||||
if (numberMotor > 1) {
|
||||
for (i = 0; i < numberMotor; i++) {
|
||||
currentMixer[i].pitch *= 0.5f;
|
||||
currentMixer[i].roll *= 0.5f;
|
||||
currentMixer[i].yaw *= 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mixerLoadMix(int index)
|
||||
|
@ -382,14 +393,22 @@ void mixTable(void)
|
|||
for (i = 0; i < numberMotor; i++) {
|
||||
if (maxMotor > mcfg.maxthrottle) // this is a way to still have good gyro corrections if at least one motor reaches its max.
|
||||
motor[i] -= maxMotor - mcfg.maxthrottle;
|
||||
motor[i] = constrain(motor[i], mcfg.minthrottle, mcfg.maxthrottle);
|
||||
if ((rcData[THROTTLE]) < mcfg.mincheck) {
|
||||
if (!feature(FEATURE_MOTOR_STOP))
|
||||
motor[i] = mcfg.minthrottle;
|
||||
else
|
||||
motor[i] = mcfg.mincommand;
|
||||
if (feature(FEATURE_3D)) {
|
||||
if ((rcData[THROTTLE]) > 1500) {
|
||||
motor[i] = constrain(motor[i], mcfg.deadband3d_high, mcfg.maxthrottle);
|
||||
} else {
|
||||
motor[i] = constrain(motor[i], mcfg.mincommand, mcfg.deadband3d_low);
|
||||
}
|
||||
} else {
|
||||
motor[i] = constrain(motor[i], mcfg.minthrottle, mcfg.maxthrottle);
|
||||
if ((rcData[THROTTLE]) < mcfg.mincheck) {
|
||||
if (!feature(FEATURE_MOTOR_STOP))
|
||||
motor[i] = mcfg.minthrottle;
|
||||
else
|
||||
motor[i] = mcfg.mincommand;
|
||||
}
|
||||
}
|
||||
if (!f.ARMED)
|
||||
motor[i] = mcfg.mincommand;
|
||||
motor[i] = feature(FEATURE_3D) ? mcfg.neutral3d : mcfg.mincommand;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue