modbus_serial: Disable rx interrupt if buffer fills up

Disable rx interrupt if the buffer fills up so that rtu_timer can fire and
process the buffer.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
This commit is contained in:
Björn Stenberg 2024-04-10 09:58:08 +02:00 committed by Anas Nashif
commit 1e3fd5361f

View file

@ -339,6 +339,12 @@ static void cb_handler_rx(struct modbus_context *ctx)
} else {
int n;
if (cfg->uart_buf_ctr == CONFIG_MODBUS_BUFFER_SIZE) {
/* Buffer full. Disable interrupt until timeout. */
modbus_serial_rx_disable(ctx);
return;
}
/* Restart timer on a new character */
k_timer_start(&cfg->rtu_timer,
K_USEC(cfg->rtu_timeout), K_NO_WAIT);