From 028f25744621d2e9df3ef7428e2699d69cfc15e3 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sat, 28 Nov 2020 22:40:08 +0000 Subject: [PATCH 01/10] Add PS3 button read and analog debug via serial --- Firmware/main.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 628332ca..19fbbc21 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -23,7 +23,12 @@ along with this program. If not, see . #include // TO DO Take this out? #include // TO DO Look again at rumble settings in XBOXONE.cpp #include +#include +// #include +// #ifdef dobogusinclude +// #include +// #endif USB_XboxGamepad_Data_t XboxOGDuke; //Xbox gamepad data structure to store all button and actuator states for the controller bool enumerationComplete=false; //Flag is set when the device has been successfully setup by the OG Xbox @@ -38,6 +43,7 @@ void setLedOn(LEDEnum led); bool controllerConnected(); XBOXONE XboxOneWired(&UsbHost); XBOXUSB Xbox360Wired(&UsbHost); +PS3USB PS3Wired(&UsbHost); int main(void) { @@ -52,6 +58,9 @@ int main(void) digitalWrite(USB_HOST_RESET_PIN, LOW); digitalWrite(ARDUINO_LED_PIN, HIGH); + Serial1.begin(9600); + Serial1.println("Serial Start"); + //Init the LUFA USB Device Library SetupHardware(); GlobalInterruptEnable(); @@ -178,6 +187,29 @@ int main(void) report[1]=0x00; } Endpoint_SelectEndpoint(ep); //set back to the old endpoint. + + if (PS3Wired.PS3Connected) { + if (PS3Wired.getAnalogHat(LeftHatX) > 137 || PS3Wired.getAnalogHat(LeftHatX) < 117 || PS3Wired.getAnalogHat(LeftHatY) > 137 || PS3Wired.getAnalogHat(LeftHatY) < 117 || PS3Wired.getAnalogHat(RightHatX) > 137 || PS3Wired.getAnalogHat(RightHatX) < 117 || PS3Wired.getAnalogHat(RightHatY) > 137 || PS3Wired.getAnalogHat(RightHatY) < 117) { + // Serial1.print(F("\r\nLeftHatX: ")); + Serial1.print(PS3Wired.getAnalogHat(LeftHatX)); + // Serial1.print(F("\tLeftHatY: ")); + Serial1.print(PS3Wired.getAnalogHat(LeftHatY)); + + // if (PS3Wired.PS3Connected) { // The Navigation controller only have one joystick + // Serial1.print(F("\tRightHatX: ")); + Serial1.print(PS3Wired.getAnalogHat(RightHatX)); + // Serial1.print(F("\tRightHatY: ")); + Serial1.print(PS3Wired.getAnalogHat(RightHatY)); + // } + } + } + + if (PS3Wired.getAnalogButton(L2) || PS3Wired.getAnalogButton(R2)) { + // Serial1.print(F("\r\nL2: ")); + Serial1.print(PS3Wired.getAnalogButton(L2)); + // Serial1.print(F("\tR2: ")); + Serial1.print(PS3Wired.getAnalogButton(R2)); + } } } @@ -203,12 +235,18 @@ uint8_t getButtonPress(ButtonEnum b){ } } + // TO DO - this almost certainly needs some work + if (PS3Wired.PS3Connected) + return (uint8_t)PS3Wired.getButtonPress(b); + return 0; } //Parse analog stick requests for each type of controller. int16_t getAnalogHat(AnalogHatEnum a){ int32_t val=0; + int16_t tmpVal=0; + uint8_t tmpVal_a=0; if (Xbox360Wired.Xbox360Connected){ val = Xbox360Wired.getAnalogHat(a); @@ -218,7 +256,16 @@ int16_t getAnalogHat(AnalogHatEnum a){ } if (XboxOneWired.XboxOneConnected) - return XboxOneWired.getAnalogHat(a); + tmpVal = XboxOneWired.getAnalogHat(a); + Serial1.println(tmpVal); + return tmpVal; + // return XboxOneWired.getAnalogHat(a); + + if (PS3Wired.PS3Connected) + tmpVal_a = PS3Wired.getAnalogHat(a); + Serial1.println(tmpVal_a); + return tmpVal_a; + // return (int16_t)PS3Wired.getAnalogHat(a); return 0; } @@ -234,6 +281,9 @@ void setRumbleOn(uint8_t lValue, uint8_t rValue){ if (XboxOneWired.XboxOneConnected){ XboxOneWired.setRumbleOn(lValue/8, rValue/8, lValue/2, rValue/2); } + + //TO DO - Add PS3 Controller Support + #endif } @@ -246,6 +296,9 @@ void setLedOn(LEDEnum led){ if (XboxOneWired.XboxOneConnected){ //no LEDs on Xbox One Controller. I think it is possible to adjust brightness but this is not implemented. } + + if (PS3Wired.PS3Connected) + PS3Wired.setLedOn(led); } bool controllerConnected(){ @@ -256,5 +309,8 @@ bool controllerConnected(){ if (XboxOneWired.XboxOneConnected) return 1; + if (PS3Wired.PS3Connected) + return 1; + return 0; } From 91d8b78d21eea114498afab50d776937f4e2b870 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 03:02:05 +0000 Subject: [PATCH 02/10] Add makehex and flash scripts to this branch --- Firmware/flash | 1 + Firmware/makehex | 4 ++++ 2 files changed, 5 insertions(+) create mode 100755 Firmware/flash create mode 100755 Firmware/makehex diff --git a/Firmware/flash b/Firmware/flash new file mode 100755 index 00000000..b16379e8 --- /dev/null +++ b/Firmware/flash @@ -0,0 +1 @@ +avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:./build/sxbca.bin -C /etc/avrdude.conf \ No newline at end of file diff --git a/Firmware/makehex b/Firmware/makehex new file mode 100755 index 00000000..bd6bae9c --- /dev/null +++ b/Firmware/makehex @@ -0,0 +1,4 @@ +cd ./build +make +avr-objcopy -O binary sxbca.elf ./sxbca.bin +cd .. From 89ba6016ee9536e367b452ba86f5e0e305198879 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 20:48:48 +0000 Subject: [PATCH 03/10] Add serial output to test values from Xbox One controller --- Firmware/main.cpp | 52 +++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 19fbbc21..98971d4c 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -42,8 +42,8 @@ void setRumbleOn(uint8_t lValue, uint8_t rValue); void setLedOn(LEDEnum led); bool controllerConnected(); XBOXONE XboxOneWired(&UsbHost); -XBOXUSB Xbox360Wired(&UsbHost); -PS3USB PS3Wired(&UsbHost); +XBOXUSB Xbox360Wired(&UsbHost); //defines EP_MAXPKTSIZE = 32 +PS3USB PS3Wired(&UsbHost); //defines EP_MAXPKTSIZE = 64 int main(void) { @@ -188,28 +188,32 @@ int main(void) } Endpoint_SelectEndpoint(ep); //set back to the old endpoint. - if (PS3Wired.PS3Connected) { - if (PS3Wired.getAnalogHat(LeftHatX) > 137 || PS3Wired.getAnalogHat(LeftHatX) < 117 || PS3Wired.getAnalogHat(LeftHatY) > 137 || PS3Wired.getAnalogHat(LeftHatY) < 117 || PS3Wired.getAnalogHat(RightHatX) > 137 || PS3Wired.getAnalogHat(RightHatX) < 117 || PS3Wired.getAnalogHat(RightHatY) > 137 || PS3Wired.getAnalogHat(RightHatY) < 117) { - // Serial1.print(F("\r\nLeftHatX: ")); - Serial1.print(PS3Wired.getAnalogHat(LeftHatX)); - // Serial1.print(F("\tLeftHatY: ")); - Serial1.print(PS3Wired.getAnalogHat(LeftHatY)); - - // if (PS3Wired.PS3Connected) { // The Navigation controller only have one joystick - // Serial1.print(F("\tRightHatX: ")); - Serial1.print(PS3Wired.getAnalogHat(RightHatX)); - // Serial1.print(F("\tRightHatY: ")); - Serial1.print(PS3Wired.getAnalogHat(RightHatY)); - // } - } + if (XboxOneWired.XboxOneConnected){ + Serial1.println(XboxOneWired.getButtonPress(R2)); } - if (PS3Wired.getAnalogButton(L2) || PS3Wired.getAnalogButton(R2)) { - // Serial1.print(F("\r\nL2: ")); - Serial1.print(PS3Wired.getAnalogButton(L2)); - // Serial1.print(F("\tR2: ")); - Serial1.print(PS3Wired.getAnalogButton(R2)); - } + // if (PS3Wired.PS3Connected) { + // if (PS3Wired.getAnalogHat(LeftHatX) > 137 || PS3Wired.getAnalogHat(LeftHatX) < 117 || PS3Wired.getAnalogHat(LeftHatY) > 137 || PS3Wired.getAnalogHat(LeftHatY) < 117 || PS3Wired.getAnalogHat(RightHatX) > 137 || PS3Wired.getAnalogHat(RightHatX) < 117 || PS3Wired.getAnalogHat(RightHatY) > 137 || PS3Wired.getAnalogHat(RightHatY) < 117) { + // // Serial1.print(F("\r\nLeftHatX: ")); + // Serial1.print(PS3Wired.getAnalogHat(LeftHatX)); + // // Serial1.print(F("\tLeftHatY: ")); + // Serial1.print(PS3Wired.getAnalogHat(LeftHatY)); + + // // if (PS3Wired.PS3Connected) { // The Navigation controller only have one joystick + // // Serial1.print(F("\tRightHatX: ")); + // Serial1.print(PS3Wired.getAnalogHat(RightHatX)); + // // Serial1.print(F("\tRightHatY: ")); + // Serial1.print(PS3Wired.getAnalogHat(RightHatY)); + // // } + // } + // } + + // if (PS3Wired.getAnalogButton(L2) || PS3Wired.getAnalogButton(R2)) { + // // Serial1.print(F("\r\nL2: ")); + // Serial1.print(PS3Wired.getAnalogButton(L2)); + // // Serial1.print(F("\tR2: ")); + // Serial1.print(PS3Wired.getAnalogButton(R2)); + // } } } @@ -257,13 +261,13 @@ int16_t getAnalogHat(AnalogHatEnum a){ if (XboxOneWired.XboxOneConnected) tmpVal = XboxOneWired.getAnalogHat(a); - Serial1.println(tmpVal); + // Serial1.println(tmpVal); return tmpVal; // return XboxOneWired.getAnalogHat(a); if (PS3Wired.PS3Connected) tmpVal_a = PS3Wired.getAnalogHat(a); - Serial1.println(tmpVal_a); + // Serial1.println(tmpVal_a); return tmpVal_a; // return (int16_t)PS3Wired.getAnalogHat(a); From 318a998891bf624216f32f8a72a7eb9cb016b636 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 21:18:10 +0000 Subject: [PATCH 04/10] Remove all serial output --- Firmware/main.cpp | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 98971d4c..78f6c3a1 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -187,33 +187,6 @@ int main(void) report[1]=0x00; } Endpoint_SelectEndpoint(ep); //set back to the old endpoint. - - if (XboxOneWired.XboxOneConnected){ - Serial1.println(XboxOneWired.getButtonPress(R2)); - } - - // if (PS3Wired.PS3Connected) { - // if (PS3Wired.getAnalogHat(LeftHatX) > 137 || PS3Wired.getAnalogHat(LeftHatX) < 117 || PS3Wired.getAnalogHat(LeftHatY) > 137 || PS3Wired.getAnalogHat(LeftHatY) < 117 || PS3Wired.getAnalogHat(RightHatX) > 137 || PS3Wired.getAnalogHat(RightHatX) < 117 || PS3Wired.getAnalogHat(RightHatY) > 137 || PS3Wired.getAnalogHat(RightHatY) < 117) { - // // Serial1.print(F("\r\nLeftHatX: ")); - // Serial1.print(PS3Wired.getAnalogHat(LeftHatX)); - // // Serial1.print(F("\tLeftHatY: ")); - // Serial1.print(PS3Wired.getAnalogHat(LeftHatY)); - - // // if (PS3Wired.PS3Connected) { // The Navigation controller only have one joystick - // // Serial1.print(F("\tRightHatX: ")); - // Serial1.print(PS3Wired.getAnalogHat(RightHatX)); - // // Serial1.print(F("\tRightHatY: ")); - // Serial1.print(PS3Wired.getAnalogHat(RightHatY)); - // // } - // } - // } - - // if (PS3Wired.getAnalogButton(L2) || PS3Wired.getAnalogButton(R2)) { - // // Serial1.print(F("\r\nL2: ")); - // Serial1.print(PS3Wired.getAnalogButton(L2)); - // // Serial1.print(F("\tR2: ")); - // Serial1.print(PS3Wired.getAnalogButton(R2)); - // } } } @@ -260,16 +233,10 @@ int16_t getAnalogHat(AnalogHatEnum a){ } if (XboxOneWired.XboxOneConnected) - tmpVal = XboxOneWired.getAnalogHat(a); - // Serial1.println(tmpVal); - return tmpVal; - // return XboxOneWired.getAnalogHat(a); + return XboxOneWired.getAnalogHat(a); if (PS3Wired.PS3Connected) - tmpVal_a = PS3Wired.getAnalogHat(a); - // Serial1.println(tmpVal_a); - return tmpVal_a; - // return (int16_t)PS3Wired.getAnalogHat(a); + return (int16_t)PS3Wired.getAnalogHat(a); return 0; } From 280632f1c5ae06fee384e5db8174f9a13dd88f15 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 21:19:39 +0000 Subject: [PATCH 05/10] Remove debug vars --- Firmware/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 78f6c3a1..9ea630ab 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -222,8 +222,6 @@ uint8_t getButtonPress(ButtonEnum b){ //Parse analog stick requests for each type of controller. int16_t getAnalogHat(AnalogHatEnum a){ int32_t val=0; - int16_t tmpVal=0; - uint8_t tmpVal_a=0; if (Xbox360Wired.Xbox360Connected){ val = Xbox360Wired.getAnalogHat(a); From 7fced79c731f4171fc5199f295000f443b95cb75 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 23:18:49 +0000 Subject: [PATCH 06/10] Correctly transform output from PS3 analog sticks --- Firmware/main.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 9ea630ab..973c63fe 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -221,20 +221,26 @@ uint8_t getButtonPress(ButtonEnum b){ //Parse analog stick requests for each type of controller. int16_t getAnalogHat(AnalogHatEnum a){ - int32_t val=0; + int32_t xbOval=0; + uint8_t ps3val = 127; + int16_t ps3conv = 0; if (Xbox360Wired.Xbox360Connected){ - val = Xbox360Wired.getAnalogHat(a); - if(val==-32512) //8bitdo range fix - val=-32768; - return val; + xbOval = Xbox360Wired.getAnalogHat(a); + if(xbOval==-32512) //8bitdo range fix + xbOval=-32768; + return xbOval; } if (XboxOneWired.XboxOneConnected) return XboxOneWired.getAnalogHat(a); if (PS3Wired.PS3Connected) - return (int16_t)PS3Wired.getAnalogHat(a); + if (a == RightHatY || a == LeftHatY) { + return (PS3Wired.getAnalogHat(a) - 127) * -255; + } else { + return (PS3Wired.getAnalogHat(a) - 127) * 255; + } return 0; } From 4a0993471bff13c40d18a8fe8fd581fa0ccba100 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Sun, 29 Nov 2020 23:33:07 +0000 Subject: [PATCH 07/10] Get correct values from PS3 controller R2 and L2 --- Firmware/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 973c63fe..8e734703 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -213,9 +213,13 @@ uint8_t getButtonPress(ButtonEnum b){ } // TO DO - this almost certainly needs some work - if (PS3Wired.PS3Connected) - return (uint8_t)PS3Wired.getButtonPress(b); - + if (PS3Wired.PS3Connected) { + if (b == R2 || b == R1) { + return PS3Wired.getAnalogButton(b); + } else { + return (uint8_t)PS3Wired.getButtonPress(b); // TO DO - is this cast needed now? + } + } return 0; } From 8c56985701a66ba889f74eab71d7210a01e02d83 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Mon, 30 Nov 2020 00:18:57 +0000 Subject: [PATCH 08/10] Remap PS3 face buttons --- Firmware/main.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 8e734703..f4bc1b5b 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -200,6 +200,8 @@ void sendControllerHIDReport(){ //Parse button presses for each type of controller uint8_t getButtonPress(ButtonEnum b){ + uint8_t ps3Val = 0; + if (Xbox360Wired.Xbox360Connected) return Xbox360Wired.getButtonPress(b); @@ -214,11 +216,35 @@ uint8_t getButtonPress(ButtonEnum b){ // TO DO - this almost certainly needs some work if (PS3Wired.PS3Connected) { - if (b == R2 || b == R1) { - return PS3Wired.getAnalogButton(b); - } else { - return (uint8_t)PS3Wired.getButtonPress(b); // TO DO - is this cast needed now? + switch (b) { + case A: + ps3Val = (uint8_t)PS3Wired.getButtonPress(CROSS); // TO DO - are these casts needed now? + break; + case B: + ps3Val = (uint8_t)PS3Wired.getButtonPress(CIRCLE); + break; + case X: + ps3Val = (uint8_t)PS3Wired.getButtonPress(SQUARE); + break; + case Y: + ps3Val = (uint8_t)PS3Wired.getButtonPress(TRIANGLE); + break; + case R1: + ps3Val = (uint8_t)PS3Wired.getAnalogButton(R1); + break; + case R2: + ps3Val = (uint8_t)PS3Wired.getAnalogButton(R2); + break; + default: + ps3Val = (uint8_t)PS3Wired.getButtonPress(b); } + + // if (b == R2 || b == R1) { + // return PS3Wired.getAnalogButton(b); + // } else { + // return (uint8_t)PS3Wired.getButtonPress(b); // TO DO - is this cast needed now? + // } + return ps3Val; } return 0; } From 13767aac068f137aa432e5937c4518401aaf6af5 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Mon, 30 Nov 2020 00:36:07 +0000 Subject: [PATCH 09/10] Add comments to PS3 remapping/analog scaling code and gerneral tidy up --- Firmware/main.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index f4bc1b5b..514d9f69 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -24,11 +24,6 @@ along with this program. If not, see . #include // TO DO Look again at rumble settings in XBOXONE.cpp #include #include -// #include - -// #ifdef dobogusinclude -// #include -// #endif USB_XboxGamepad_Data_t XboxOGDuke; //Xbox gamepad data structure to store all button and actuator states for the controller bool enumerationComplete=false; //Flag is set when the device has been successfully setup by the OG Xbox @@ -43,7 +38,7 @@ void setLedOn(LEDEnum led); bool controllerConnected(); XBOXONE XboxOneWired(&UsbHost); XBOXUSB Xbox360Wired(&UsbHost); //defines EP_MAXPKTSIZE = 32 -PS3USB PS3Wired(&UsbHost); //defines EP_MAXPKTSIZE = 64 +PS3USB PS3Wired(&UsbHost); //defines EP_MAXPKTSIZE = 64. The change causes a compiler warning but doesn't seem to affect operation int main(void) { @@ -58,8 +53,11 @@ int main(void) digitalWrite(USB_HOST_RESET_PIN, LOW); digitalWrite(ARDUINO_LED_PIN, HIGH); - Serial1.begin(9600); - Serial1.println("Serial Start"); + // The Serial1 port on the Arduino Leonardo (pins 20 & 21) is useful for debugging via a USB to Serial module + // while the Arduino appears as an Xbox controller via its built in USB port + + // Serial1.begin(9600); + // Serial1.println("Serial Start"); //Init the LUFA USB Device Library SetupHardware(); @@ -151,12 +149,11 @@ int main(void) commandTimer=millis(); } - /*Check/send the Player 1 HID report every loop to minimise lag even more on the master*/ sendControllerHIDReport(); } - //Handle Player 1 controller connect/disconnect events. + //Handle controller connect/disconnect events. if (controllerConnected() && disconnectTimer==0){ USB_Attach(); if(enumerationComplete){ @@ -202,7 +199,6 @@ void sendControllerHIDReport(){ uint8_t getButtonPress(ButtonEnum b){ uint8_t ps3Val = 0; - if (Xbox360Wired.Xbox360Connected) return Xbox360Wired.getButtonPress(b); @@ -214,9 +210,9 @@ uint8_t getButtonPress(ButtonEnum b){ } } - // TO DO - this almost certainly needs some work if (PS3Wired.PS3Connected) { switch (b) { + // Remap the PS3 controller face buttons to their Xbox counterparts case A: ps3Val = (uint8_t)PS3Wired.getButtonPress(CROSS); // TO DO - are these casts needed now? break; @@ -229,21 +225,18 @@ uint8_t getButtonPress(ButtonEnum b){ case Y: ps3Val = (uint8_t)PS3Wired.getButtonPress(TRIANGLE); break; + // Call a different function from the PS3USB library to get the level of + // pressure applied to the R2 and L2 triggers, not just 'on' or 'off case R1: ps3Val = (uint8_t)PS3Wired.getAnalogButton(R1); break; case R2: ps3Val = (uint8_t)PS3Wired.getAnalogButton(R2); break; + // Requests for the start, select, R1, L1 and the D-pad buttons can be called normally default: ps3Val = (uint8_t)PS3Wired.getButtonPress(b); } - - // if (b == R2 || b == R1) { - // return PS3Wired.getAnalogButton(b); - // } else { - // return (uint8_t)PS3Wired.getButtonPress(b); // TO DO - is this cast needed now? - // } return ps3Val; } return 0; @@ -266,6 +259,8 @@ int16_t getAnalogHat(AnalogHatEnum a){ return XboxOneWired.getAnalogHat(a); if (PS3Wired.PS3Connected) + // Scale up the unsigned 8bit values produced by the PS3 analog sticks to the + // signed 16bit values expected by the Xbox. In the case of the Y axes, invert the result if (a == RightHatY || a == LeftHatY) { return (PS3Wired.getAnalogHat(a) - 127) * -255; } else { From be4b782d114991e87fa8043b82604f48a7efdbd1 Mon Sep 17 00:00:00 2001 From: Jim Narey Date: Mon, 30 Nov 2020 00:54:19 +0000 Subject: [PATCH 10/10] Correct reference to wrong PS3 trigger button in getButtonPress --- Firmware/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/main.cpp b/Firmware/main.cpp index 514d9f69..755b92e2 100644 --- a/Firmware/main.cpp +++ b/Firmware/main.cpp @@ -226,9 +226,9 @@ uint8_t getButtonPress(ButtonEnum b){ ps3Val = (uint8_t)PS3Wired.getButtonPress(TRIANGLE); break; // Call a different function from the PS3USB library to get the level of - // pressure applied to the R2 and L2 triggers, not just 'on' or 'off - case R1: - ps3Val = (uint8_t)PS3Wired.getAnalogButton(R1); + // pressure applied to the L2 and R2 triggers, not just 'on' or 'off + case L2: + ps3Val = (uint8_t)PS3Wired.getAnalogButton(L2); break; case R2: ps3Val = (uint8_t)PS3Wired.getAnalogButton(R2);