Skip to content

Commit 054e6b3

Browse files
authored
Fixes HardwareSerial::availableForWrite + setTxBufferSize (#6998)
1 parent 860b104 commit 054e6b3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: cores/esp32/esp32-hal-uart.c

+4
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ uint32_t uartAvailableForWrite(uart_t* uart)
238238
}
239239
UART_MUTEX_LOCK();
240240
uint32_t available = uart_ll_get_txfifo_len(UART_LL_GET_HW(uart->num));
241+
size_t txRingBufferAvailable = 0;
242+
if (ESP_OK == uart_get_tx_buffer_free_size(uart->num, &txRingBufferAvailable)) {
243+
available += txRingBufferAvailable;
244+
}
241245
UART_MUTEX_UNLOCK();
242246
return available;
243247
}

0 commit comments

Comments
 (0)