rdepena / node-dualshock-controller

Eventing API layer over HID for the Sony DualShock 3 and DualShock 4 controllers
208 stars 46 forks source link

Added rumble/light ability, updated readme. #54

Closed reeceaw closed 7 years ago

reeceaw commented 7 years ago

Added the ability to control the controller rumble (left and right) as well as the light on the rear of the DS4 controllers. Seems to work with my DS4 controller (newer productId from last PR), not sure how well it'd work on different ones. Might need some sort of controller validation (to make sure it doesn't try to set the light and rumble when it is incompatible with the connected controller). Thoughts?

rdepena commented 7 years ago

Awesome, Hey @reeceaw could you take a few minutes and make it so that the data package template, in this case [0x05, 0xff, 0x04, 0x00, defaults] is specified in the config json ?

Then I could add the DS3 template and it would work cross controller.

Thank you, this looks great.

reeceaw commented 7 years ago

Not quite sure what you mean @rdepena - Like you want the default data in config.js?

rdepena commented 7 years ago

Hey @reeceaw, I need to pull up an experiments branch somewhere with an example, give me a few days.

reeceaw commented 7 years ago

Cool @rdepena, sounds good

rdepena commented 7 years ago

So it took a bit of searching (on an old computer) but I found an experimental branch where I was playing with the rumble and LEDs on the dualshock 3, btw this experiment is for sure not the way to go but it should be something like it where the actual data package that the controller is expecting is found in the controllerConfiguration json file along with some metadata that would allow for someone to quickly see what needs to change.

Again I do not love this but look at the "output" config section, it has both the template and named indexes for what values need to be replaced: https://github.com/rdepena/node-dualshock-controller/blob/feature/experiments_dualshock3_rumble/controllerConfigurations/dualShock3.json#L158

This is used by (I do not like this name) the controller_output.js module: https://github.com/rdepena/node-dualshock-controller/blob/feature/experiments_dualshock3_rumble/lib/controller_output.js

So I guess we need to spend some time thinking about how to include the DS4 changes you did and take some lessons from this experiment branch and turn it into the actual implementation.

If this seems like too much involvement just let me know, I shelved this branch because I was missing the piece that you wrote (DS4) so I could take pick it up again now with all the discovery done. Thank you.

rdepena commented 7 years ago

These changes are included in #55