SoftwareSerial: fix flush() behaviour

Fix #4029
This commit is contained in:
Cristian Maglie 2015-11-11 16:28:48 +01:00
parent ab82f330b5
commit 7bd71f04b0
1 changed files with 1 additions and 7 deletions

View File

@ -469,13 +469,7 @@ size_t SoftwareSerial::write(uint8_t b)
void SoftwareSerial::flush() void SoftwareSerial::flush()
{ {
if (!isListening()) // There is no tx buffering, simply return
return;
uint8_t oldSREG = SREG;
cli();
_receive_buffer_head = _receive_buffer_tail = 0;
SREG = oldSREG;
} }
int SoftwareSerial::peek() int SoftwareSerial::peek()