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:
parent
f3679ab2c2
commit
1e3fd5361f
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue