BastienMaes / homebridge-S7-PLC

Homebridge plugin for S7 PLC
MIT License
0 stars 0 forks source link

LightBulb writes complete byte #4

Closed Feilner closed 2 years ago

Feilner commented 4 years ago

When light bulb writes complete byte instead of only the required bit. By this non affected bits are reset Instead of

buf[0] = Math.pow(2, dbbit);
S7Client.DBWrite(db, dbbyte, 1, buf, function(err)

the method

buf[0] = 1;
S7Client.WriteArea(S7Client.S7AreaDB, db, ((dbbyte*8) + dbbit), 1, S7Client.S7WLBit, buf, function(err)

should be used.