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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user