Skip to content

Commit 9fce9c7

Browse files
WereCatfigrr
authored andcommitted
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
1 parent b81ef01 commit 9fce9c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cores/esp8266/HardwareSerial.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ void HardwareSerial::flush()
152152
}
153153

154154
uart_wait_tx_empty(_uart);
155+
//Workaround for a bug in serial not actually being finished yet
156+
//Wait for 8 data bits, 1 parity and 2 stop bits, just in case
157+
delayMicroseconds(11000000 / uart_get_baudrate(_uart) + 1);
155158
}
156159

157160
size_t HardwareSerial::write(uint8_t c)

0 commit comments

Comments
 (0)