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

Fix write-single-coil.ts incorrect processing of true value #338 #339

Open
wants to merge 1 commit into
base: v4.0-dev
Choose a base branch
from

Conversation

yangit
Copy link

@yangit yangit commented Apr 20, 2024

Fix for the #338
The WriteSingleCoilResponseBody constructor declares that it can handle boolen but it can not do that. So I have addled boolean handling into the function.

Manually tested for both true and false input.

I have tried to make commit a oneliner like so
this._value = value === ( true || 0xFF00 ? 0xFF00 : 0x0000)
But did not find it readable enough and did not like being dependent on parenthesis

I have not added any automated test for this fix because unfortunately I'm unable to properly run npm install neither on my mac nor on ubuntu, the SerialPort package fails to install and I have further issues with mocha (I did try to install that globally along with sinon).

Hope that helps!

…omation#338

The WriteSingleCoilResponseBody constructor declares that it can handle `boolen` but it can not do that.
So I have addled  boolean handling into the function.
@stefanpoeter
Copy link
Member

Hi @yangit, thank you for your commitment. This needs to be tested in the unit test. Can you provide a test?

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.

None yet

2 participants