steveohara / j2mod

Enhanced Modbus library implemented in the Java programming language
Apache License 2.0
276 stars 110 forks source link

RS485 echo in RTU mode #51

Closed davidhuwyler closed 7 years ago

davidhuwyler commented 7 years ago

I have echo turned on (rs485 with echo) and using RTU coding. Now not the whole echo gets ignored. The crc of the master-request is taken as slave response.

The problem is in the class ModbusRTUTransport: if (echo) { readEcho(len); }

there should be 'readEcho(len +2);' +2 for the 2 crc bytes... the same as in the class ModbusBINTransport. There this is already fixed... I fixed this locally and it works great!

steveohara commented 7 years ago

Added to 2.3.6 snapshot