feat(transport-bluetooth): use write with response #20704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We need to dynamically change bluetooth write params when we are sending big messages like for example FW update.
briefly explanation:
WriteWithoutResponse(default - fast) sends the message but doesnt guarantee the delivery, we dont know if bluetooth central (adapter) really send it and is it safe to send another chunk.WriteWithResponse(slower) - sends the message and waits for delivery confirmation (ACK sent by bluetooth peripheral)Those params behaves differently on each OS:
WriteWithoutResponseworks as expected and doesnt need any workaroud.WriteWithoutResponsesends the message immediately (~1ms) - after a while it keep loosing the packets when the OS buffer is full. Additionally i've fixed one bug in btleblug dependency - hopefully it will be merged soon.WriteWithoutResponseis also very fast and it is clogging the OS buffer (loosing packets) yetWriteWithResponseis deadly slowTo optimize FW update process we need custom approach.
WriteWithResponseon first 8 packets and then on each 16nth packet.WriteWithoutResponsebut throttle it and use delay if sending speed it too fast🔍🖥️ Suite web test results: View in Currents
🔍🖥️ Suite desktop test results: View in Currents