Page 1 of 1

SoftwareSerial::read()

Posted: 16 Dec 2018 13:24
by bastibart
Dear developers

The Z-Uno implementation of SoftwareSerial::read() has two problems

1.
If the buffer is empty, read() returns 0
whereas the Arduino implementation returns -1.

2.
read() will return data beyond the end pointer of the buffer and wrap around to previously read data.

I think many would appreciate the implemention to be changed to match the standard implentation.
The neccessary changes in the source code are minimal.

Cheers
Sebastian

Re: SoftwareSerial::read()

Posted: 16 Dec 2018 14:33
by PoltoS
Thank you for your feedback. We will add it to our list

Re: SoftwareSerial::read()

Posted: 16 Dec 2018 17:03
by bastibart
Great - thanks.

I made a huge mistake in my initial post.
read() returns of course -1 when the buffer is empty. I edited my post.