Make sure we are done writing before setting a new baudrate (#503)

This commit is contained in:
Erik Olof Gunnar Andersson 2024-11-21 00:54:10 +01:00 committed by GitHub
parent 17873069a2
commit b9126910d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,6 +46,10 @@ void SERIAL_init(void)
void SERIAL_set_baud(int baud)
{
ESP_LOGI(TAG, "Changing UART baud to %i", baud);
// Make sure that we are done writing before setting a new baudrate.
uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS);
uart_set_baudrate(UART_NUM_1, baud);
}