Closed joesphan closed 3 years ago
Hi,I set the value mapping in: https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary/blob/45ee061d4e71ee2fea0028fa0f76bbae1a2398cf/src/Joystick.cpp#L581 you can modify the mapping value range yourself.
Thanks for your reply. I made a fork right now implementing an adjustable range, feel free to merge it.
Joystick.cpp:
/* J.L 9/10/2020
* modified ffb range to depend on the variable 'FFBRange'
*/
void Joystick_::forceCalculator(int32_t* forces) {
///////////////////////////////////
forces[0] = constrain(forces[0], -_FFBRange, _FFBRange);
forces[1] = constrain(forces[1], -_FFBRange, _FFBRange);
}
Joystick.h:
/* J.L 9/10/2020
* range of force feedback, default is 9 bit (-255 to 255)
* can be set using joystick::setFFBRange(int range)
*/
int _FFBRange = 255;
///////////////////////////////////
void Joystick_::setFFBRange(int range)
{
_FFBRange = range;
}
////////////////////////////////////
the README in my fork is updated to match as well. calling of gains is different from before as well.
thanks for all your help with this project of mine, without your library, I would still be stuck on getting USB HID to work.
Hello! Sorry to bug you again, I have implemented your code into my FFB wheel project (on my page), using a mige servo and a generic servo drive. I am wondering if it is possible to get higher than 9 bit resolution on the force feedback (8 bit each way, -255 to 255). The game I have tested is BeamNG.drive, and it only gives me 8 bit values. I would like to take advantage of the 13 bit analog control resolution on my servo drive.
Thanks in advance!