iOS Question BLE delay while sending fast data

Mike1970

Well-Known Member
Licensed User
Longtime User
hi everyone, I've an ESP32 and I connect to it using BLE.
I want to send data in a fast way to control a ws2812 RGB led strip... but seems to be not possible.. there is a sort of delay.

Just for testing I modified the original BLE Example by Erel to add a slider.
Take a look at the video, when I stop sliding the data are still arriving... is there something I can do to improve the speed?



I tried using "WriteData" instead of "WriteDataWithResponse" but in this way nothing is sent...
BTW what is the point of "WriteData"?

P.S. on ESP side there is only the simplest sample code with just the callback for incoming data... nothing else, what It get it prints

thanks in advance
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Are you testing in release mode?
2. Can you test it with B4A and an Android device? The code should be very similar.
BTW what is the point of "WriteData"?
I don't remember the exact details but not all writable characteristics support the "write with response" method and the same is true for "write without response".
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
1. Are you testing in release mode?
Yes, it is the same, but read till the end

2. Can you test it with B4A and an Android device? The code should be very similar.
No because I think I just found the answer, in case I will update the thread

I don't remember the exact details but not all writable characteristics support the "write with response" method and the same is true for "write without response".
Yes, I asked chatGPT for the difference and it answered back that with PROPERTY_WRITE the esp32 sends back an ACK, with PROPERTY_WRITE_NR (no response) it does not send the ACK... faster but not 100% reliable, its like TCP vs UDP
So the effect on B4X side is the activation or not of the manager_WriteComplete sub.




So, I changed the code of my esp32 to have the PROPERTY_WRITE_NR instead, and in this way the data transfer is MUCH faster, but as I said the WriteComplete sub is now useless
 
Upvote 0
Top