st-one-io / nodes7

A javascript library to communicate with Siemens S7 PLCs
GNU General Public License v3.0
34 stars 9 forks source link

Bug when writing more than 12 Boolean variables #8

Open FiloCara opened 2 years ago

FiloCara commented 2 years ago

Hello

There is a bug which prevent to write more than 12 Boolean variables at the same time. This issue is strictly related to the one I opened a while ago for the node-red-contrib-s7 package (https://github.com/st-one-io/node-red-contrib-s7/issues/90)

Steps to reproduce: Write more than 12 Boolean variables at the same time using the writeItems method of the S7ItemGroup class. This raises a request timeout.

Problem: After investigating, the problem seems related to the way the reqItemLength variable is computed.

A writing_var (s7) request for multiple Boolean variables requires the following bytes:

The reqItemLength does not take into account the fill byte. I'm going to open a pull request to fix it.

Filippo