mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
artf4107: Removed most "Init" functions from classes
They were either replaced with delegating constructors or merged into the only constructor in the class. Change-Id: I3d35139f6ab23c719433a9f76942b02a3b07ddac
This commit is contained in:
@@ -16,27 +16,17 @@ constexpr float Servo::kMinServoAngle;
|
||||
constexpr float Servo::kDefaultMaxServoPWM;
|
||||
constexpr float Servo::kDefaultMinServoPWM;
|
||||
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*
|
||||
* InitServo() assigns defaults for the period multiplier for the servo PWM
|
||||
* control signal, as
|
||||
* well as the minimum and maximum PWM values supported by the servo.
|
||||
*/
|
||||
void Servo::InitServo() {
|
||||
SetBounds(kDefaultMaxServoPWM, 0.0, 0.0, 0.0, kDefaultMinServoPWM);
|
||||
SetPeriodMultiplier(kPeriodMultiplier_4X);
|
||||
|
||||
LiveWindow::GetInstance()->AddActuator("Servo", GetChannel(), this);
|
||||
HALReport(HALUsageReporting::kResourceType_Servo, GetChannel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channel The PWM channel to which the servo is attached. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
Servo::Servo(uint32_t channel) : SafePWM(channel) {
|
||||
InitServo();
|
||||
// Set minimum and maximum PWM values supported by the servo
|
||||
SetBounds(kDefaultMaxServoPWM, 0.0, 0.0, 0.0, kDefaultMinServoPWM);
|
||||
|
||||
// Assign defaults for period multiplier for the servo PWM control signal
|
||||
SetPeriodMultiplier(kPeriodMultiplier_4X);
|
||||
|
||||
// printf("Done initializing servo %d\n", channel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user