-
Notifications
You must be signed in to change notification settings - Fork 54
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
Reading/Polling Buffer #4
Comments
Using the BLE characteristic "Notify" seems right to me. I'm not sure what may be the cause in your description. One thing you could try out is changing your bluetooth dongle. For my project I tried 3 different ones until the last one had the performance I'd expect from BLE. But I doubt that is the reason here. The timespan of half a minute reminds me of another thing. I am also using an ESP32. The BLE-connection ( Another problem I had was when I sent data from the ESP too fast. I guess that was also due to data congestion, probably on ESP side but could also be on dongle or Windows side. Enforcing a maximum packages per second rate should avoid that. That could explain why it starts working when your ESP waits 512 sensor readings before it sends a package. |
Or you can try out writing packages to your ESP in a regular interval (<30s, e.g. 2s). |
Thanks again for the help. You definitely brought be on the right track here again :)
So accessing Turns out, the keyword for my problem is, like you mentioned, "data congestion". After reading your reply I tried one simple thing. .. and this ACTUALLY seems to have done the trick. It's not that I hadn't thought about it, but idk like I said - I was a bit on the wrong track :) |
@adabru Do you remember the dongle that you used? |
Sorry, I don't ☹. It was provided in the office. |
Hey, it's me again :D
I hope I'm not bugging you by now ;) But I'd really need your advice again :/
So here's the thing:
I'm packaging uint8 (sbyte) packages on my ESP32 and sending them as 1 byte packets over my characteristic:
uint8_t package[1]; package[0] = convertRawAngleToDegrees(ams5600.getRawAngle()); pCharacteristicCommand->setValue(package, 1); pCharacteristicCommand->notify();
It does nothing but continiously sending out a current HALL sensor angle value over BLE.
Then in Unity I have a Thread thats reading the buffer like you showed in your example "ReadPackage()" function:
Impl.BLEData packageReceived; bool result = Impl.PollData(out packageReceived, true);
First I couldn't figure out how to access the data without HUGE latency (half a minute or so), until I made a really unpretty workaround:
On my ESP32 I created a full package with 512 one byte packages before sending it out. With this "throwing s*** on the wall until it sticks approach" I could access my values from Unity ;)
This was fine for debugging, but using the data for a game/simulation input is far too slow :/
On the UWP platform one could use the DataReader Interface I guess? Do I have a similar option with your DLL?
I have also an Android app where I can receive the same data perfectly with a BLE characteristic "Notify".
I have tried it in block and non block mode btw, but I'm not sure wether I used it correctly.
Long story short: How can I read the LATEST momentary value sent out from my BLE device at any given time?
Like I said, I'm sorry to have to bother you again, but I have tried for several hours ;(
The text was updated successfully, but these errors were encountered: