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

WriteSingleCoilRequest.setCoil(true) always fails #60

Closed
wielantu opened this issue Feb 9, 2021 · 1 comment
Closed

WriteSingleCoilRequest.setCoil(true) always fails #60

wielantu opened this issue Feb 9, 2021 · 1 comment

Comments

@wielantu
Copy link
Contributor

wielantu commented Feb 9, 2021

It is not possible to send a WriteSingleCoilRequest with value true/ON.

The fix for #33 added a short cast to the value parameter in Modbus.java:

    static public boolean checkRegisterValue(int value) {
        return checkRange((short)value, 0, Modbus.MAX_REGISTER_VALUE);
    }

So

   Modbus.checkRegisterValue(COIL_VALUE_ON); 

always returns false.

This means

WriteSingleCoilRequest.setCoil(true) 

always fails.

@wielantu wielantu changed the title WriteSingleCoilRequest with value ON always fails WriteSingleCoilRequest.setValue(true) always fails Feb 9, 2021
@wielantu wielantu changed the title WriteSingleCoilRequest.setValue(true) always fails WriteSingleCoilRequest.setCoil(true) always fails Feb 9, 2021
@wielantu
Copy link
Contributor Author

wielantu commented Feb 9, 2021

This is a duplicate of #52

@wielantu wielantu closed this as completed Feb 9, 2021
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

No branches or pull requests

1 participant