cmseaton42 / node-ethernet-ip

A Lightweight Ethernet/IP API written to interface with Rockwell ControlLogix/CompactLogix Controllers.
MIT License
265 stars 106 forks source link

BOOL is always read as False #32

Closed balex3 closed 6 years ago

balex3 commented 6 years ago

Current Behavior

PLC.connect("192.168.0.2", 0).then(async () => {
    const fooTag = new Tag("BoolTag");
    setInterval(async function(){
        await PLC.readTag(fooTag);
        console.log(fooTag);
    }, 2500);
});

Expected Behavior

Any BOOL tag I attempt to read is always false.

Possible Solution (Optional)

Context

Cannot read bool values, I have updated library.

Steps to Reproduce (for bugs only)

1. 2. 3. 4.

Your Environment

balex3 commented 6 years ago

Apologies I found the difference. For /tag/index.js:418 My version

this.controller_value = data.readUInt8(2) === 0xff ? true : false;

Latest version

data.readUInt8(2) !== 0

jhenson29 commented 6 years ago

Sorry about that. Earlier firmware versions return 0xff and later ones return 0x01. I'm not which version the change was made in. I know v20 is 0xff and v29 is 0x01. I'm glad you were able to update and fix the issue.

cmseaton42 commented 6 years ago

Related to #29

Closed with #30