mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Check and coerce rumble inputs to range of 0 - 1.
Change-Id: Ic2ee301549e68e8cc56f91755521f456c8d0b5f7
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user