Open
Conversation
These files contain static functions that will cause unused function warnings when ModbusMaster.h is included by applications.
The library only returns an error code with no other explanation so it's impossible to debug unexpected errors in communication such as: - Receiving continuous noise on the line (missing ground wire) - Receiving additional zero bytes (missing bias resistors) Allow callback functions to be specified so that messages can be logged for debugging.
A slave device could indicate that there are 255 bytes in the response here: u8BytesLeft = u8ModbusADU[2]; There are only 256 bytes of space in ModbusADU so the additional 255 bytes would overflow the buffer. Increase the size of ModbusADUSize so that it is large enough to handle the byte at index 255 without wrapping around to 0, and use it to check that there is enough space for the response. When we run out of space, return a new error type ku8MBResponseTooLarge (0xE4).
If Stream::read() returns -1 then 0xFF will be added to the buffer. Check the return value before using it as data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some fixes for v2.01 based on testing with a slave device: