Allow all models to use servo tilt.

See #1006
This commit is contained in:
Dominic Clifton 2015-06-10 15:31:47 +01:00
parent 889b14df5f
commit 7db626747d
2 changed files with 10 additions and 14 deletions

View File

@ -442,10 +442,10 @@ STATIC_UNIT_TESTED void forwardAuxChannelsToServos(uint8_t firstServoIndex)
}
}
static void updateGimbalServos(void)
static void updateGimbalServos(uint8_t firstServoIndex)
{
pwmWriteServo(0, servo[SERVO_GIMBAL_PITCH]);
pwmWriteServo(1, servo[SERVO_GIMBAL_ROLL]);
pwmWriteServo(firstServoIndex + 0, servo[SERVO_GIMBAL_PITCH]);
pwmWriteServo(firstServoIndex + 1, servo[SERVO_GIMBAL_ROLL]);
}
void writeServos(void)
@ -479,11 +479,6 @@ void writeServos(void)
pwmWriteServo(servoIndex++, servo[SERVO_FLAPPERON_2]);
break;
case MIXER_GIMBAL:
updateGimbalServos();
servoIndex += 2;
break;
case MIXER_DUALCOPTER:
pwmWriteServo(servoIndex++, servo[SERVO_DUALCOPTER_LEFT]);
pwmWriteServo(servoIndex++, servo[SERVO_DUALCOPTER_RIGHT]);
@ -503,14 +498,15 @@ void writeServos(void)
break;
default:
// Two servos for SERVO_TILT, if enabled
if (feature(FEATURE_SERVO_TILT)) {
updateGimbalServos();
servoIndex += 2;
}
break;
}
// Two servos for SERVO_TILT, if enabled
if (feature(FEATURE_SERVO_TILT)) {
updateGimbalServos(servoIndex);
servoIndex += 2;
}
// forward AUX1-4 to servo outputs (not constrained)
if (gimbalConfig->gimbal_flags & GIMBAL_FORWARDAUX) {
forwardAuxChannelsToServos(servoIndex);

View File

@ -827,7 +827,7 @@ static bool processOutCommand(uint8_t cmdMSP)
break;
#ifdef USE_SERVOS
case MSP_SERVO:
s_struct((uint8_t *)&servo, 16);
s_struct((uint8_t *)&servo, MAX_SUPPORTED_SERVOS * 2);
break;
case MSP_SERVO_CONF:
headSerialReply(MAX_SUPPORTED_SERVOS * 7);