nodes7
nodes7 copied to clipboard
Bug when writing more than 12 Boolean variables
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:
- HEADER: 10 bytes
- PARAMETERS: 2 bytes + 12 bytes per variable
- DATA: 4 bytes per variable + 1 byte per variable + 1 extra fill byte per variable (something like a separator character)
The reqItemLength does not take into account the fill byte. I'm going to open a pull request to fix it.
Filippo