Skip to content

Commit

Permalink
Fix hang in Serial.flush()
Browse files Browse the repository at this point in the history
_state will be 0x2 for half-duplex mode, so we need to be careful with
operator precedence to test only the low bit. Without this change,
Serial.flush() hangs when half-duplex is enabled and no data has yet
been sent.
  • Loading branch information
jvasileff committed Nov 5, 2024
1 parent 0a26ed8 commit b422af0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megaavr/cores/megatinycore/UART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
// If we have never written a byte, no need to flush. This special
// case is needed since there is no way to force the TXCIF (transmit
// complete) bit to 1 during initialization
if (!_state & 1) {
if (!(_state & 1)) {
return;
}

Expand Down

0 comments on commit b422af0

Please sign in to comment.