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

bool read bug #19

Closed
nuannuande opened this issue May 22, 2018 · 1 comment
Closed

bool read bug #19

nuannuande opened this issue May 22, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@nuannuande
Copy link

bool var not right

Current Behavior

in tag/index.js this.controller_value = data.readUInt8(2) === 0x01 ? true : false;

i test while the bool is true ,the return data is <buff 00 ff>
so this.controller_value = data.readUInt8(2) === 0xff ? true : false;

Expected Behavior

Possible Solution (Optional)

Context

Steps to Reproduce (for bugs only)

Your Environment

  • Package version (Use npm list - e.g. 1.0.6):
  • Node Version (Use node --version - e.g. 9.8.0):
  • Operating System and version:
  • Controller Type (eg 1756-L83E/B):
  • Controller Firmware (eg 30.11):
@cmseaton42 cmseaton42 self-assigned this May 24, 2018
@cmseaton42 cmseaton42 added the bug Something isn't working label May 24, 2018
@cmseaton42
Copy link
Owner

cmseaton42 commented May 24, 2018

@nuannuande We are aware of this issue. I am pretty busy at the moment so it may be a bit before I can get to it. As a work around, you could read the entire word and then look at individual bits of the read data via the native javascript bitwise operators. Something like the following could work for now.

let bit;

// Let's say we are concerned with the 3rd bit of readTag (readTag.2)
//     then the following should work
bit = readTag & 0b00000100 !== 0 ? true : false;

That said, we would love some help continuing to develop library, thus pull requests are welcome 😄.

We really appreciate you using the project and helping us uncover some of these bugs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants