mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[wpilib] PWMSpeedController.get(): Apply Inversion (#3016)
This makes get() return the value actually sent to the motor. This is a breaking change.
This commit is contained in:
@@ -13,7 +13,7 @@ void PWMSpeedController::Set(double speed) {
|
||||
}
|
||||
|
||||
double PWMSpeedController::Get() const {
|
||||
return GetSpeed();
|
||||
return GetSpeed() * (m_isInverted ? -1.0 : 1.0);
|
||||
}
|
||||
|
||||
void PWMSpeedController::SetInverted(bool isInverted) {
|
||||
|
||||
@@ -28,7 +28,9 @@ class PWMSpeedController : public PWM, public SpeedController {
|
||||
void Set(double value) override;
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
* Get the recently set value of the PWM. This value is affected by the
|
||||
* inversion property. If you want the value that is sent directly to the
|
||||
* SpeedController, use {@link PWM#getSpeed()} instead.
|
||||
*
|
||||
* @return The most recently set value for the PWM between -1.0 and 1.0.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user