UsbSerial
UsbSerial copied to clipboard
SerialInputStream read function
There seems to be an issue with the SerialInputStream read to buffer function.
If the user calls the serialInput.read() to check for new data and afterwards calls serialInput.available() to find out how many more bytes are available the following call to serialInput.read(buffer) should obtain all the previous bytes of data obtained and only afterwards issue a issue a syncRead to get the rest of the data.
The current implementations makes it a bit more complex to implement communication API where the first byte of the message is always the size.
I'm having the same problem.