diff --git a/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDcDevices.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDcDevices.cs index 31cea2131..0078f19f2 100644 --- a/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDcDevices.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDcDevices.cs @@ -17,7 +17,7 @@ public class TruConvertAcDcDevices public TruConvertAcDcDevices(Channel transport) { - var modbusClient = new ModbusTcpClient(transport, 0); + var modbusClient = new ModbusTcpClient(transport, slaveId: 0); _SystemControl = new ModbusDevice(modbusClient); @@ -57,21 +57,21 @@ public class TruConvertAcDcDevices public void Write(AcDcDevicesRecord r) { - if (r.SystemControl is not null) - _SystemControl.Write(r.SystemControl); // must run BEFORE the attached devices - - foreach (var (ctrl, device) in r.Devices.Zip(_AcDcs)) + try { - try + if (r.SystemControl is not null) + _SystemControl.Write(r.SystemControl); // must run BEFORE the attached devices + + foreach (var (ctrl, device) in r.Devices.Zip(_AcDcs)) { device.Write(ctrl); } - catch (Exception e) - { - Console.WriteLine(e); - // TODO: log - } } + catch (Exception e) + { + Console.WriteLine(e); + // TODO: log + } } } \ No newline at end of file