mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Fixed bug in Serial.available() causing it to return incorrect values when the head wrapped around. Thanks to Don Cross.
This commit is contained in:
parent
5a39312e74
commit
cfeb4a3bce
@ -291,7 +291,7 @@ void serialWrite(unsigned char c)
|
|||||||
|
|
||||||
int serialAvailable()
|
int serialAvailable()
|
||||||
{
|
{
|
||||||
return (rx_buffer_head - rx_buffer_tail) % RX_BUFFER_SIZE;
|
return (RX_BUFFER_SIZE + rx_buffer_head - rx_buffer_tail) % RX_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int serialRead()
|
int serialRead()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user