ESP32-BLE-Gamepad
ESP32-BLE-Gamepad copied to clipboard
Is it possible to implement force feedback?
Is there a possibility to get ffb?
Hi
Was asked a couple of years ago
https://github.com/lemmingDev/ESP32-BLE-Gamepad/issues/12
Out of my area of expertise
If someone wants to take a crack at it and create a pull request, it would be greatly appreciated.
Sorry for my poor english. with ffb do you mean a simple vibrator motor?, i found an app for android that test the gamepad and the vibration, can you catch this command and implement it to the library? or this is the complicated part?
Sorry. I have no idea how to get it working...
Force feedback or haptic is possible, but not yet quite standard, at least not in my very basic research.
There are a few options:
- make your own interface for your project ie: BLE serial - https://www.hackster.io/chuartdo/ble-haptic-dual-joystick-controller-31c2c2
- emulate one of the other vendors haptic system XBox/PSX controller (not sure the legal status) -
- setup the correct HID and output fields with callbacks, like CapsLock LED - https://github.com/tloimu/adapt-ffb-joy/tree/wiki
- Possible part of 3 - Extend support for FFB in SDL2 - https://github.com/libsdl-org/SDL/tree/main/src/joystick/hidapi
3 and 4 are something in my spare time I am trying to understand and added, but it's slow going and just a little over my current skill level.
Hope this might help somebody else just start their progress.
Ok!, I'm gonna try to work on it
That would be great. Let me know if you make any progress
Let me jump into this issue because I'm also interested in it.
@Narsku https://github.com/lemmingDev/ESP32-BLE-Gamepad/issues/99#issuecomment-1134022276
i found an app for android that test the gamepad and the vibration, can you catch this command and implement it to the library? or this is the complicated part?
Which app did you try? I also want to try the app.
Seems some of the info needed is here https://www.usb.org/sites/default/files/pid1_01_0.pdf
And here's an Arduino Leonado joystick library with force feedback https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary
I have been reading through the ArduinoJoystickWithFFBLibrary repo and came across https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary/issues/30#issuecomment-870345902 where extending the HID PID seems to get FFB working in Linux, so I was thinking of extending ESP32-BLE-Gamepad PID to include the changes for test - https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary/blob/master/src/FFBDescriptor.h
but after about a 1/3 of the way through, worried about any typos or other problems, hoping there might be a quicker or even better way to do this, for just a test? @lemmingDev you have an idea? Need to take into account, Report IDs (not got to the point to test yet)- Was thinking about just making a Report IDs and offset from the init base.
My fork and branch in it's current state - https://github.com/LeeNX/ESP32-BLE-Gamepad/commits/leet-ffb-pid
Also thinking, if we going to use this code, we should possible ask or inform https://github.com/YukMingLaw that we doing this? Just good citizenship ... I will reach out, if nobody else beats me too it.
Hi @LeeNX
Have you had any luck getting the FFB to work? I was looking at using ESP32-S2 and convert the ArduinoJoystickWithFFBLibrary to work with the esp32, but if this works that's even better.
Thanks
@MatthewReed303 still in progress, have not made much headway since my last post. Not much feedback either, so I am not sure if anybody else would find this useful. I am still keen and interested and will come back to this. Just need to find the time and motivation. Have some free time coming up in two weeks, so I think I will be able to get to at least testing PID with OSX and Linux (Raspberry Pi) with SDL 2/3.
Been hacking at a simple console testing program, to test some of my ideas. Was very interested in seeing very much different feature reporting back on Linux vs OSX. On Linux, if I set SDL hint that my BLE devices is PS4 controller, not much changes, but on OSX, when hinted as PS4 controller, the serial number from BLE is reported back differently. SDL feature (bug) that I was not expecting. I don't even remember why I did think of even trying this.
I hope there is more interest, which would be motivating for me.
Does this library have a callback for messages received from the PC? I'm trying to do some latency measurements and my idea was to send FFB messages to the controller and respond back with a button press thus having the full round-trip latency.
I'm using the [Fino](https://github.com/jmriego/Fino] library which based on the YukMingLaw to create an Arduino FFB Yoke for FlightSim. I'm thinking about to make a new design of the yoke to make it smaller and may be use an ESP32 processor to bring my project to a next level (Bluetooth, faster, wifi).
Is there any progress of implementation of FFB? You would make may people very happy for implement, especially the Flightsim and RacinSim Guys!
Xinput fork of library here that does rumble https://github.com/Mystfit/ESP32-BLE-CompositeHID
No progress on force feedback