stm32/machine_uart: Return number of bytes written even with timeout.

The errcode should be cleared so the caller sees a successful write, even
if it's a short write.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-08-07 17:48:13 +10:00
parent c94a3205b0
commit d8b033776e

View File

@@ -533,6 +533,7 @@ static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
if (*errcode == 0 || *errcode == MP_ETIMEDOUT) {
// return number of bytes written, even if there was a timeout
*errcode = 0;
return num_tx << self->char_width;
} else {
return MP_STREAM_ERROR;