bbcmicrobit / PythonEditor

A MicroPython editor for the BBC micro:bit that works with browsers.
https://python.microbit.org/
MIT License
198 stars 130 forks source link

Reduce Transfer Mismatch Errors #279

Closed microbit-sam closed 3 years ago

microbit-sam commented 5 years ago

https://github.com/ARMmbed/dapjs/issues/51

To try and reduce the number of Uncaught (in promise) Error: Bad response for 131 -> 132 or Uncaught (in promise) Error: Bad response for 132 -> 131 errors, I've grouped writes together to only occur every 20ms

Creating this as a draft for discussion, as I'm not sure this is going to be the correct approach, it appears to improve, but does not solve the issue

microbit-sam commented 5 years ago

It does look like responses are coming back in the wrong order when startSerialRead() is active and the terminal is trying to write data to DAP Link

target.serialWrite("help()\r\n");
Promise {<pending>}
webusb.ts:200 USBOutTransferResult {bytesWritten: 10, status: "ok"}
webusb.ts:200 USBOutTransferResult {bytesWritten: 1, status: "ok"}
cmsis-dap.ts:150 Sent: 132
cmsis-dap.ts:152 Uint8Array(64) [131, 62, 76, 105, 110, 107, 58, 79, 118, 101, 114, 102, 108, 111, 119, 62, 10, 104, 101, 108, 112, 40, 41, 13, 10, 87, 101, 108, 99, 111, 109, 101, 32, 116, 111, 32, 77, 105, 99, 114, 111, 80, 121, 116, 104, 111, 110, 32, 111, 110, 32, 116, 104, 101, 32, 109, 105, 99, 114, 111, 58, 98, 105, 116]
microbit-carlos commented 3 years ago

We are not really seeing this issue anymore since DAPLink was updated, so we don't need this PR anymore. Thanks for the submission Sam! Sorry it didn't get merge in the end.