Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support conditional ignore of Modbus broadcast frames #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthiesenj
Copy link

@matthiesenj matthiesenj commented Jan 22, 2021

The reason for this is a case where I have several identical slaves on the bus (fulfilling different, but similar roles), and sometimes it is desirable to instruct a slave to ignore the collective.

karlp added a commit to etactica/freemodbus that referenced this pull request Jun 9, 2022
If user provided address checking is enabled, the user function takes
complete responsibility for validating.  An example function would be:

```
BOOL isMBUserAddressValid( UCHAR ucMBAddress, UCHAR ucRcvAddress )
{
        if (
                /* Accept our originally configured address */
                (ucMBAddress == ucRcvAddress) ||
                /* Accept all even, non-broadcast addresses less than 50 */
                (ucRcvAddress > 0 && ucRcvAddress < 50 && ((ucRcvAddress & 0x1) == 0))
        ) {
                return true;
        }
        return false;
}

```

This allows fixing issues such as: cwalter-at#27
in a more general fashion.

Note that this does not affect the STRICT_ADDRESSING or
QUIRK_REPLY_BROADCAST_READ options, which are _after_ we have decided to
look at the frame.

Signed-off-by: Karl Palsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants