Skip to content

ModbusSlave library: ERROR: the index 'writeValues' does not exist #10

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

Open
ragrus-nbl opened this issue Apr 27, 2023 · 0 comments
Open

Comments

@ragrus-nbl
Copy link

If I try to write a zero value to a coil or a register, I get ERROR: the index 'writeValues' does not exist from the ModbusSlave library.

This is due to this incorrect check: https://github.com/electricimp/Modbus/blob/master/ModbusSlave/ModbusSlave.device.lib.nut#L171

If a zero value is provided, this code doesn't do result.writeValues <- writeValues but expects the writeValues field for any write operation.

To fix this, it's enough to check writeValues != null there. So zero value will pass this check too.

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