node-modbus-serial
node-modbus-serial copied to clipboard
debug should only output buffer received from TCP, not the generated CRC added to it
servertcp appends a generated CRC to the buffer right before logging the data it received. This is misleading because it makes it look like the CRC was part of the data the client sent, but TCP clients don't send a CRC.
Looks like it needs the CRC because it passes it to the RTU code to process, which verifies the CRC. I suppose the quick fix is to move the code that adds the CRC to be after the debug statement, and the better fix is to parse the CRC outside the function so you don't need to append a CRC at all for data arriving via TCP.