Tracker: reorder servo functions

No functional change.
Flow runs from top to bottom with functions at top of file calling those
lower down.
This commit is contained in:
Randy Mackay 2014-10-06 15:02:24 +09:00
parent a43a8ccfa0
commit b6634bb416
1 changed files with 27 additions and 30 deletions

View File

@ -20,6 +20,27 @@ static void init_servos()
channel_pitch.calc_pwm();
}
/**
update the pitch (elevation) servo. The aim is to drive the boards ahrs pitch to the
requested pitch, so the board (and therefore the antenna) will be pointing at the target
*/
static void update_pitch_servo(float pitch)
{
switch ((enum ServoType)g.servo_type.get()) {
case SERVO_TYPE_ONOFF:
update_pitch_onoff_servo(pitch);
break;
case SERVO_TYPE_POSITION:
default:
update_pitch_position_servo(pitch);
break;
}
// convert servo_out to radio_out and send to servo
channel_pitch.calc_pwm();
channel_pitch.output();
}
/**
update the pitch (elevation) servo. The aim is to drive the boards ahrs pitch to the
@ -112,30 +133,27 @@ static void update_pitch_onoff_servo(float pitch)
}
}
/**
update the pitch (elevation) servo. The aim is to drive the boards ahrs pitch to the
requested pitch, so the board (and therefore the antenna) will be pointing at the target
update the yaw (azimuth) servo.
*/
static void update_pitch_servo(float pitch)
static void update_yaw_servo(float yaw)
{
switch ((enum ServoType)g.servo_type.get()) {
case SERVO_TYPE_ONOFF:
update_pitch_onoff_servo(pitch);
update_yaw_onoff_servo(yaw);
break;
case SERVO_TYPE_POSITION:
default:
update_pitch_position_servo(pitch);
update_yaw_position_servo(yaw);
break;
}
// convert servo_out to radio_out and send to servo
channel_pitch.calc_pwm();
channel_pitch.output();
channel_yaw.calc_pwm();
channel_yaw.output();
}
/**
update the yaw (azimuth) servo. The aim is to drive the boards ahrs
yaw to the requested yaw, so the board (and therefore the antenna)
@ -276,24 +294,3 @@ static void update_yaw_onoff_servo(float yaw)
channel_yaw.servo_out = 18000;
}
}
/**
update the yaw (azimuth) servo.
*/
static void update_yaw_servo(float yaw)
{
switch ((enum ServoType)g.servo_type.get()) {
case SERVO_TYPE_ONOFF:
update_yaw_onoff_servo(yaw);
break;
case SERVO_TYPE_POSITION:
default:
update_yaw_position_servo(yaw);
break;
}
// convert servo_out to radio_out and send to servo
channel_yaw.calc_pwm();
channel_yaw.output();
}