From 884a374f4e66deb2f451d59c1976b9ba7568259f Mon Sep 17 00:00:00 2001 From: Jonathan Leitschuh Date: Fri, 30 May 2014 14:19:57 -0400 Subject: [PATCH] Updates the C++ servo class to have the PWM values that are on the spec sheet Change-Id: I98eae31f91df912d17035c125b219d8a812e94f9 --- wpilibc/include/Servo.h | 5 ++++- wpilibc/lib/Servo.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wpilibc/include/Servo.h b/wpilibc/include/Servo.h index 07a034ca3f..0107e32e1b 100644 --- a/wpilibc/include/Servo.h +++ b/wpilibc/include/Servo.h @@ -51,6 +51,9 @@ private: return kMaxServoAngle - kMinServoAngle; } - static constexpr float kMaxServoAngle = 170.0; + static constexpr float kMaxServoAngle = 180.0; static constexpr float kMinServoAngle = 0.0; + + static constexpr float kDefaultMaxServoPWM = 2.4; + static constexpr float kDefaultMinServoPWM = .6; }; diff --git a/wpilibc/lib/Servo.cpp b/wpilibc/lib/Servo.cpp index 53a66251e7..46ddec89f0 100644 --- a/wpilibc/lib/Servo.cpp +++ b/wpilibc/lib/Servo.cpp @@ -12,6 +12,9 @@ constexpr float Servo::kMaxServoAngle; constexpr float Servo::kMinServoAngle; +constexpr float Servo::kDefaultMaxServoPWM; +constexpr float Servo::kDefaultMinServoPWM; + /** * Common initialization code called by all constructors. * @@ -21,7 +24,7 @@ constexpr float Servo::kMinServoAngle; void Servo::InitServo() { m_table = NULL; - SetBounds(2.27, 1.513, 1.507, 1.5, .743); + SetBounds(kDefaultMaxServoPWM, 0.0, 0.0, 0.0, kDefaultMinServoPWM); SetPeriodMultiplier(kPeriodMultiplier_4X); LiveWindow::GetInstance()->AddActuator("Servo", GetModuleNumber(), GetChannel(), this);