Skip to content

Overload writeValue to allow forced write without response #146

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

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

facchinm
Copy link
Contributor

When a characteristic is declared (Write | WriteWithoutResponse) the code always creates a request
and expects a response.
By setting withResponse=false the user can bypass the request and write a responseless command.

Reworks and supersedes #72

@facchinm facchinm requested a review from polldo November 30, 2020 09:01
@facchinm
Copy link
Contributor Author

@bitbank2 I opened this to trigger the CI; would you mind testing it in your environment before we merge it? Thanks

@facchinm facchinm force-pushed the writeWithoutResponse branch from 3e2915a to 62f276c Compare November 30, 2020 09:06
@bitbank2
Copy link

I'll give it a try today. Thanks :)

@bitbank2
Copy link

bitbank2 commented Dec 1, 2020

I have two 2 tests for the BLE speed. One connects to a BLE thermal printer and prints some graphics and the other uses my VirtualDisplay and sends SSD1306 gfx data over the BLE connection. The Thermal printer test shows that your fix works, but the VirtualDisplay doesn't show any speed improvement. The ESP32 is able to send data 5x faster than the Nano33 under the same conditions. I don't understand why the data transmission on the Nano33 is so much slower even when writeWithoutResponse is used. The last comment I have is that the option to write without response should probably be added to all of the various writeValue() methods too.

@polldo
Copy link
Contributor

polldo commented Dec 1, 2020

Hi @bitbank2 , so this patch is working and it causes the same effects of #72. I guess that the speed problems also exist with your other solution, am I correct?
Then, the BLE speed depends on:

  • the connection interval range, set during devices connection (here). The smaller the number, the faster it is. The minimum is already set to the minimum allowed: 0x0006 (corresponding to 1.25 ms). You could try to force the actual connection interval to the minimum by setting also the maximum value to 0x0006 this way:
    if (HCI.leCreateConn(0x0060, 0x0030, 0x00, peerBdaddrType, peerBdaddr, 0x00, 0x0006, 0x0006, 0x0000, 0x00c8, 0x0004, 0x0006) != 0) {

  • the actual BLE controller, that in case of the nano33 is CORDIO from arm. You can try with a nano iot that has a different controller.

@bitbank2
Copy link

bitbank2 commented Dec 4, 2020

Please merge and close this PR.

When a characteristic is declared (Write | WriteWithoutResponse) the code always creates a request
and expects a response.
By setting withResponse=false the user can bypass the request and write a responseless command.

Reworks and supersedes arduino-libraries#72
@polldo polldo force-pushed the writeWithoutResponse branch from c8e0ea6 to 8a167ad Compare December 18, 2020 09:35
@polldo polldo merged commit be365c9 into arduino-libraries:master Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants