Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
471 stars 175 forks source link

Modbus serial does not inject data when response is received #51

Closed SuperJojo2001 closed 8 years ago

SuperJojo2001 commented 8 years ago

With the following patch in file "modbus-serial-client.js" data can be received from a server after polling for data

 var onData = function (pdu) {
         this.log.debug('received data');
        this.emit('data', pdu.slice(1));

The point is that every Modbus RTU response includes as first byte the slave address mirrored. Before the patch the whole PDU as received has been handed over to the emitter. With the patch the PDU without the first byte is handed over.

SuperJojo2001 commented 8 years ago

Created the pull request #56