Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Button Hold Duty Cycle #56

Open
AustinSaintAubin opened this issue Dec 24, 2016 · 1 comment
Open

Feature Request: Button Hold Duty Cycle #56

AustinSaintAubin opened this issue Dec 24, 2016 · 1 comment

Comments

@AustinSaintAubin
Copy link

Is there a way to set the dutycycle of the button hold function.
Right now when I hold a button on the controller the '{button}:hold' functions fire off rather fast.
I need the functions like controller.on('square:hold', () => console.log('square hold')); to fire off much slower, like every 250ms.

I think it would be easiest to be able to pass a buttonHoldDutycycle option when init the controller &/OR be able pass the cycle rate per button decoration controller.on('square:hold', 250, () => console.log('square hold'));.

Concept:

var dualShock = require('dualshock-controller');

//pass options to init the controller.
var controller = dualShock(
    {
        //you can use a ds4 by uncommenting this line.
        //config: "dualshock4-generic-driver",
        //if using ds4 comment this line.
        config : "dualShock3",
        //smooths the output from the acelerometers (moving averages) defaults to true
        accelerometerSmoothing : true,
        //smooths the output from the analog sticks (moving averages) defaults to false
        analogStickSmoothing : false

        // Button Hold Dutycycle
        buttonHoldDutycycle : 250  // 250ms
    });

//connect the controller
controller.connect();

// Button Hold (will cycle at a rate of 250mm because of passed buttonHoldDutycycle in controller int)
controller.on('square:hold', () => console.log('square hold'));

// Button Hold (will cycle at a rate of 500mm because of passed 500 in function)
controller.on('triangle:hold', 500, () => console.log('triangle hold'));
@AustinSaintAubin AustinSaintAubin changed the title Button Hold Duty Cycle Feature Request: Button Hold Duty Cycle Dec 24, 2016
@rdepena
Copy link
Owner

rdepena commented Dec 27, 2016

@AustinSaintAubin yea, this makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants