JibbSmart / JoyShockLibrary

Read DualSense, DualShock 4, JoyCon, and Pro Controller input on PC -- compiled for Windows, but code should work on other platforms.
Other
226 stars 42 forks source link

I can not disable both small and big rumble if light colour is not black. #38

Open Colon-D opened 3 years ago

Colon-D commented 3 years ago

I would like to be able to disable rumble when the colour is not black.

I can set small rumble to one and big rumble to zero, and I can set the small rumble to zero and big rumble to one. Both of these are close to what I want, but neither is what I want. If both small rumble and big rumble are set to their highest value of 255, then both to zero, they remain at 255. The same is true for trying to disable rumble from any other value.

The current workaround I have is to set the colour to black, disable rumble, and then reset the colour to what it was. This work around works pretty well if you do it only when wanting to disable rumble. You can only notice the workaround if you stare at the light, even then most times it is fine. I wanted to post this issue in case others come across this problem.

Example program that sets rumble to full for two seconds, then tries to disable rumble for two seconds then ends the program:

#include <iostream>
#include <thread>
#include <JoyShockLibrary.h>

int main() {
    // connect devices
    JslConnectDevices();
    // add any amount of color (this could also be done after setting rumble to full)
    JslSetLightColour(0, 0x00000001);
    // set rumble to full
    std::cout << "Setting rumble to full.\n";
    JslSetRumble(0, 255, 255);
    // wait two seconds
    std::this_thread::sleep_for(std::chrono::seconds{ 2 });
    // set rumble to none
    std::cout << "Setting rumble to none. RUMBLE SHOULD BE DISABLED NOW.\n";
    JslSetRumble(0, 0, 0);
    // wait for two seconds second then stop
    std::this_thread::sleep_for(std::chrono::seconds{ 2 });
    std::cout << "End of program.\n";
    JslDisconnectAndDisposeAll();
    return EXIT_SUCCESS;
}

It sets rumble to full for two seconds, then tries to disable rumble for two seconds then ends the program.

I am on Windows 10, using a slightly modified version of the latest release of your library - Version 2.2.0 (I added vcpkg support for personal use)