Skip to content

Conversation

@Booplicate
Copy link
Contributor

Issue:

If you check how you're handling writing to multiple registers, you notice you're using explicit is None check, which allows passing "falsy" values.

However for coils, you're doing not check, which means it's impossible to write 0 as it will get converted to an empty list.

It's not a big deal and it's a good practice to explicitly wrap values into a list, but since you do support it for input registers, can make sense to support for coils as well.

Changelog:

  • replaces not check with explicit is None
  • added a test case for this

Note:

I'm not too familiar with pytest, but I hope I added a valid test case for this.

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

Just wondering if the opposite solution would have been better (bring coil inline).

@janiversen janiversen merged commit 267cedd into pymodbus-dev:dev Aug 8, 2023
@Booplicate
Copy link
Contributor Author

Just wondering if the opposite solution would have been better (bring coil inline).

Up to you, wasn't sure about that since it'd be a breaking change.

@Booplicate Booplicate deleted the fix-faulty-not-check branch August 8, 2023 17:14
@janiversen
Copy link
Collaborator

good point, lets keep it the way you made it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants