Remove code duplication for gimbal servo updates.

This commit is contained in:
Dominic Clifton 2014-04-18 21:04:10 +01:00
parent 799844d933
commit 7b079ca297
1 changed files with 8 additions and 4 deletions

View File

@ -258,6 +258,12 @@ void mixerLoadMix(int index)
}
}
static void updateGimbalServos(void)
{
pwmWriteServo(0, servo[0]);
pwmWriteServo(1, servo[1]);
}
void writeServos(void)
{
if (!core.useServo)
@ -288,8 +294,7 @@ void writeServos(void)
break;
case MULTITYPE_GIMBAL:
pwmWriteServo(0, servo[0]);
pwmWriteServo(1, servo[1]);
updateGimbalServos();
break;
case MULTITYPE_DUALCOPTER:
@ -308,8 +313,7 @@ void writeServos(void)
default:
// Two servos for SERVO_TILT, if enabled
if (feature(FEATURE_SERVO_TILT)) {
pwmWriteServo(0, servo[0]);
pwmWriteServo(1, servo[1]);
updateGimbalServos();
}
break;
}