1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Add a workaround-delay in Serial.flush() (#3714)

* Add a workaround-delay in Serial.flush()

In relation to #2536 and #2502

Tested at 80MHz and 160MHz with flash-frequency at both 40MHz and 80MHz, the bug mentioned in the above issues manifests in all cases. The proposed workaround seems to work fine, I tested at 2400bps, 9600bps, 115200bps, 230400bps and 2Mbps and didn't see anomalous output.

* Remove extraneous character

* Update HardwareSerial.cpp
This commit is contained in:
WereCatf 2017-10-15 10:05:49 +03:00 committed by Ivan Grokhotkov
parent b81ef01ef7
commit 9fce9c792c

View File

@ -152,6 +152,9 @@ void HardwareSerial::flush()
} }
uart_wait_tx_empty(_uart); uart_wait_tx_empty(_uart);
//Workaround for a bug in serial not actually being finished yet
//Wait for 8 data bits, 1 parity and 2 stop bits, just in case
delayMicroseconds(11000000 / uart_get_baudrate(_uart) + 1);
} }
size_t HardwareSerial::write(uint8_t c) size_t HardwareSerial::write(uint8_t c)