Improve USB communications #910
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.
This was initiated by @uzlonewolf's idea of "command queuing" which sended new commands to PM3 before the previous had been acknowledged. This didn't work for Windows (see discussion in #901). It turned out that this was in fact another approach to circumvent the timeouts in uart_receive() which tend to delay uart_send(). The same was already achieved by blocking the communication thread on CMD_ACK during flashing.
This PR enables the block on CMD_ACK in general. Plus it allows variable sized responses similar to @doegox's work on RRG repo (but with less code changes).
Ah yes, and this improves the key checking speed from 219keys/sec to 238 keys/sec.