Avoid updating servos to servo middle every loop iteration.
This commit is contained in:
parent
a1b01807cf
commit
debd72485b
|
@ -285,6 +285,11 @@ void mixerInit(mixerMode_e mixerMode, motorMixer_t *initialCustomMixers)
|
||||||
// if we want camstab/trig, that also enables servos, even if mixer doesn't
|
// if we want camstab/trig, that also enables servos, even if mixer doesn't
|
||||||
if (feature(FEATURE_SERVO_TILT))
|
if (feature(FEATURE_SERVO_TILT))
|
||||||
useServo = 1;
|
useServo = 1;
|
||||||
|
|
||||||
|
// give all servos a default command
|
||||||
|
for (uint8_t i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
|
||||||
|
servo[i] = DEFAULT_SERVO_MIDDLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mixerUsePWMOutputConfiguration(pwmOutputConfiguration_t *pwmOutputConfiguration)
|
void mixerUsePWMOutputConfiguration(pwmOutputConfiguration_t *pwmOutputConfiguration)
|
||||||
|
@ -520,24 +525,21 @@ void mixTable(void)
|
||||||
int16_t maxMotor;
|
int16_t maxMotor;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
// paranoia: give all servos a default command
|
|
||||||
for (i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
|
|
||||||
servo[i] = DEFAULT_SERVO_MIDDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (motorCount > 3) {
|
if (motorCount > 3) {
|
||||||
// prevent "yaw jump" during yaw correction
|
// prevent "yaw jump" during yaw correction
|
||||||
axisPID[YAW] = constrain(axisPID[YAW], -100 - ABS(rcCommand[YAW]), +100 + ABS(rcCommand[YAW]));
|
axisPID[YAW] = constrain(axisPID[YAW], -100 - ABS(rcCommand[YAW]), +100 + ABS(rcCommand[YAW]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// motors for non-servo mixes
|
// motors for non-servo mixes
|
||||||
if (motorCount > 1)
|
if (motorCount > 1) {
|
||||||
for (i = 0; i < motorCount; i++)
|
for (i = 0; i < motorCount; i++) {
|
||||||
motor[i] =
|
motor[i] =
|
||||||
rcCommand[THROTTLE] * currentMixer[i].throttle +
|
rcCommand[THROTTLE] * currentMixer[i].throttle +
|
||||||
axisPID[PITCH] * currentMixer[i].pitch +
|
axisPID[PITCH] * currentMixer[i].pitch +
|
||||||
axisPID[ROLL] * currentMixer[i].roll +
|
axisPID[ROLL] * currentMixer[i].roll +
|
||||||
-mixerConfig->yaw_direction * axisPID[YAW] * currentMixer[i].yaw;
|
-mixerConfig->yaw_direction * axisPID[YAW] * currentMixer[i].yaw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef USE_QUAD_MIXER_ONLY
|
#ifndef USE_QUAD_MIXER_ONLY
|
||||||
// airplane / servo mixes
|
// airplane / servo mixes
|
||||||
|
|
Loading…
Reference in New Issue