plcpeople / nodeS7

Node.JS library for communication to Siemens S7 PLCs
MIT License
356 stars 120 forks source link

S7ItemGroup.writeItems having troubles writting booleans! #114

Open flacohenao opened 4 years ago

flacohenao commented 4 years ago

Hi Ghuilherme!

Writting a boolean value on a bit separated area like this:

itemGroup.writeItems("DB2,X0.1", true)

throws me this error:

ERROR WRITE TAG NodeS7Error: Write error [0x7]: Data type inconsistent
    at S7ItemGroup.writeItems (C:\Users\ACER\Documents\NODE PROJECTS\tot-bend\node_modules\nodes7\src\s7itemGroup.js:548:27)   
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 7,
  info: undefined

I also have tried passing the value as a (1 or 0), even string as ('true', 'false')

I guess that the error there didnt catch any info coz its obvious that you know what's the item you attempting to write

gfcittolin commented 4 years ago

Hi, I can confirm the issue. It is related to writing to boolean items only. This have been fixed in the past, but got intentionally reverted for some reason. I'm checking why that was the case, and will provide unit tests that cover this to prevent from happening in the future.

flacohenao commented 4 years ago

Thank you very much!!

flacohenao commented 4 years ago

@gfcittolin Hi!!!

is the commit the final fix? can you please explain what was causing the issue?