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

Change-Id: Ic2ee301549e68e8cc56f91755521f456c8d0b5f7
This commit is contained in:
Joe Ross
2014-12-08 20:45:22 -08:00
parent 19a7243bfc
commit 497f38fe0e
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