Merge "Check and coerce rumble inputs to range of 0 - 1."

This commit is contained in:
Brad Miller (WPI)
2014-12-10 05:31:55 -08:00
committed by Gerrit Code Review
2 changed files with 8 additions and 0 deletions

View File

@@ -419,6 +419,10 @@ public class Joystick extends GenericHID {
* @param value The normalized value (0 to 1) to set the rumble to
*/
public void setRumble(RumbleType type, float value) {
if (value < 0)
value = 0;
else if (value > 1)
value = 1;
if (type.value == RumbleType.kLeftRumble_val)
m_leftRumble = (short)(value*65535);
else