dwilches / Ardity

Assets for integrating Arduino and Unity (or Unity and any hardware that communicates over a COM port)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

“returnBuffer” missing from 40 to 39

NakedVane opened this issue · comments

Your code is cool, data has received safty. But I find a problem with my program. I've lost 1byte in receiving message.

Your code(class,SerialThreadBinaryDelimited):
byte[] returnBuffer = new byte[index]; System.Array.Copy(buffer, returnBuffer, index);

After I've changed. I had received all the data:

byte[] returnBuffer = new byte[index +1]; System.Array.Copy(buffer, returnBuffer, index +1);

I need receive hexadecimal 40 bytes from comm, but recived 39 bytes. I've got all the message after I changed above code. Is it a problem?

Hello,

In your mesasage, the byte you were missing was the delimiter byte, is that right?
The original code was written to not return the delimiter byte, but if you want it, then the change you did is the correct fix.

If you were missing a different byte (not the delimiter) then, can you show me a sample message from your command?

Regards.

Er.....Everything good with orther samples so far. Thank you!