LucidVR / lucidgloves

Arduino/ESP32 based DIY VR Haptic gloves. Compatible with SteamVR via OpenGloves.
MIT License
2.02k stars 259 forks source link

Add BLE Communication #96

Open Kozova1 opened 1 year ago

Kozova1 commented 1 year ago

This PR adds BLE communication to the LucidGloves firmware.
Opengloves doesn't support it yet, so the only way to test it ATM is to use some kind of BLE explorer app on your phone.

I verified that this works and sends the data as expected on my phone.

Kozova1 commented 1 year ago

Currently has a limitation: Notify doesn't work with the current protocol, since it seems to be limited to about 20 bytes of payload. Maybe a more compact protocol can be used for BLE (maybe sending it as packed binary data?), or even just have a notify characteristic that tells the driver to read the "real" characteristic.

Kozova1 commented 1 year ago

It might be doable if we send the flexion values as shorts (16bit), and since they're 0-4095 always we can also use the upper 4 bits of the short for various booleans. This way we have exactly enough space, with maybe a few single bits left over. I'd prefer not to do this because this makes the implementation way harder on the decoder, and doesn't leave any room to expand in the future.

What I think should be done instead is to add a "data updated" characteristic, that simply notifies when the glove's data was changed, and then opengloves will need to know that when it receives that, it should read the full glove data.

Kozova1 commented 1 year ago

Unfortunately, due to private reasons I won't be able to work on the opengloves side