The returned trigger values are only 10-bits

This commit is contained in:
Kristian Sloth Lauszus 2018-03-15 21:25:39 +01:00
parent 25572863b7
commit a37d0c0ea5

View file

@ -68,8 +68,8 @@ void loop() {
if (Xbox.getButtonPress(L2) != oldL2Value || Xbox.getButtonPress(R2) != oldR2Value) { if (Xbox.getButtonPress(L2) != oldL2Value || Xbox.getButtonPress(R2) != oldR2Value) {
oldL2Value = Xbox.getButtonPress(L2); oldL2Value = Xbox.getButtonPress(L2);
oldR2Value = Xbox.getButtonPress(R2); oldR2Value = Xbox.getButtonPress(R2);
uint8_t leftRumble = map(oldL2Value, 0, 65535, 0, 255); // Map the trigger values into a byte uint8_t leftRumble = map(oldL2Value, 0, 1023, 0, 255); // Map the trigger values into a byte
uint8_t rightRumble = map(oldR2Value, 0, 65535, 0, 255); uint8_t rightRumble = map(oldR2Value, 0, 1023, 0, 255);
if (leftRumble > 0 || rightRumble > 0) if (leftRumble > 0 || rightRumble > 0)
Xbox.setRumbleOn(leftRumble, rightRumble, leftRumble, rightRumble); Xbox.setRumbleOn(leftRumble, rightRumble, leftRumble, rightRumble);
else else