Hi, while reading your library I have noticed that in a poll method for master module you have defined shortest possible frame as 6 bytes. What is correct but only for correct responses, for the error responses it should be 5 (including CRC).
For example error response for command 0x01 will look like:
[Address] [Function code] [exception] [CRC HI] [CRC LO]
so even though you are later validating answer to be an error in validateAnswer it will never come true since those frames are prevously eliminated due to the lenght.
https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino/blob/df2fc9b6a14aa872bac24ab5255ba15ab43498e9/ModbusRtu.h#L668
Hi, while reading your library I have noticed that in a poll method for master module you have defined shortest possible frame as 6 bytes. What is correct but only for correct responses, for the error responses it should be 5 (including CRC).
For example error response for command 0x01 will look like: [Address] [Function code] [exception] [CRC HI] [CRC LO]
so even though you are later validating answer to be an error in validateAnswer it will never come true since those frames are prevously eliminated due to the lenght.
Part of the Modbus 1.1b documentation: