Skip to content

Commit 3b70a0b

Browse files
Rocketctsandeepmistry
authored andcommitted
Fix repeated Uart Tx packet in Rx Uart channel
This fix allow to solve the problem of the repeated Tx packet in uart rx channel #2, it was tested with the example ModbusRTUTemperatureSensor, it show that the master unit receive only one time te packet, and that the packet is not replicated on the Uart rx channel.
1 parent ae14987 commit 3b70a0b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libmodbus/modbus-rtu.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,11 @@ static ssize_t _modbus_rtu_send(modbus_t *ctx, const uint8_t *req, int req_lengt
327327

328328
ssize_t size;
329329

330+
RS485.noReceive();
330331
RS485.beginTransmission();
331332
size = RS485.write(req, req_length);
332333
RS485.endTransmission();
334+
RS485.receive();
333335

334336
return size;
335337
#else

0 commit comments

Comments
 (0)