Return S7CommunicationException

This commit is contained in:
Peter Butzhammer
2024-02-08 18:30:49 +01:00
parent 5d85823167
commit b43a595e13
6 changed files with 53 additions and 62 deletions

View File

@@ -164,10 +164,7 @@ public class Sharp7Plc : IPlc
// Special handling for bools, which are written on a by-bit basis. Writing a complete byte would
// overwrite other bits within this byte.
if (address.Bit == null)
throw new InvalidOperationException("Address must have a Bit to write a bool.");
await s7Connector.WriteBit(address.Operand, address.Start, address.Bit.Value, (bool) (object) value, address.DbNr, token);
await s7Connector.WriteBit(address.Operand, address.Start, address.Bit!.Value, (bool) (object) value, address.DbNr, token);
}
else
{