diff --git a/README.md b/README.md index 0226bde..b44b086 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ ds.close() # closing the controller See ``examples`` folder for some more ideas +# Help wanted + +Help wanted from people that want to use this and have feature requests. Just open a issue with the correct label. # dependecies @@ -32,7 +35,9 @@ See ``examples`` folder for some more ideas # Credits -Most stuff for this implementation were provided by published an used from: + +Most stuff for this implementation were provided by and used from: + - [https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/](https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/) - [https://github.com/Ryochan7/DS4Windows](https://github.com/Ryochan7/DS4Windows) diff --git a/pydualsense/pydualsense.py b/pydualsense/pydualsense.py index cb0624f..5f7ed2a 100644 --- a/pydualsense/pydualsense.py +++ b/pydualsense/pydualsense.py @@ -14,11 +14,10 @@ class pydualsense: self.send_report_size = 48 self.color = (0,0,255) # set color around touchpad to blue + self.leftMotor = 0 + self.rightMotor = 0 - - - - + def init(self): """initialize module and device """ @@ -79,7 +78,18 @@ class pydualsense: dual_sense = hid.Device(vid=detected_device['vendor_id'], pid=detected_device['product_id']) return dual_sense + def setLeftMotor(self, intensity: int): + if intensity > 255: + raise Exception('maximum intensity is 255') + self.leftMotor = intensity + + def setRightMotor(self, intensity: int): + if intensity > 255: + raise Exception('maximum intensity is 255') + self.rightMotor = intensity + + # right trigger def setRightTriggerMode(self, mode: TriggerModes): """set the trigger mode for R2 @@ -207,10 +217,10 @@ class pydualsense: """ states = list(inReport) # convert bytes to list # states 0 is always 1 - self.state.LX = states[1] - self.state.LY = states[2] - self.state.RX = states[3] - self.state.RY = states[4] + self.state.LX = states[1] - 127 + self.state.LY = states[2] - 127 + self.state.RX = states[3] - 127 + self.state.RY = states[4] - 127 self.state.L2 = states[5] self.state.R2 = states[6] @@ -306,8 +316,8 @@ class pydualsense: # 0x80 ??? outReport[2] = 0x1 | 0x2 | 0x4 | 0x10 | 0x40 # [2] - outReport[3] = 0 # left low freq motor 0-255 # [3] - outReport[4] = 0 # right low freq motor 0-255 # [4] + outReport[3] = self.leftMotor # left low freq motor 0-255 # [3] + outReport[4] = self.rightMotor # right low freq motor 0-255 # [4] # outReport[5] - outReport[8] audio related diff --git a/setup.py b/setup.py index ca9da78..3244c29 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r") as fh: setup( name='pydualsense', - version='0.2.0', + version='0.3.0', description='use your DualSense (PS5) controller with python', long_description=long_description, long_description_content_type="text/markdown",