One try catch instead of two for DcDcDeviceRecord Read()
This commit is contained in:
parent
b213d97537
commit
c51250a380
|
@ -35,22 +35,12 @@ public class TruConvertDcDcDevices
|
|||
|
||||
public DcDcDevicesRecord Read()
|
||||
{
|
||||
SystemControlRegisters? scStatus;
|
||||
|
||||
try
|
||||
{
|
||||
scStatus = _SystemControl.Read();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return DcDcDevicesRecord.Null;
|
||||
}
|
||||
|
||||
var scStatus = _SystemControl.Read();
|
||||
var n = scStatus.NumberOfConnectedSlaves;
|
||||
|
||||
try
|
||||
{
|
||||
var dcDcRecords = _DcDcs
|
||||
.Take(n)
|
||||
.Select(dcdc => dcdc.Read())
|
||||
|
@ -61,7 +51,7 @@ public class TruConvertDcDcDevices
|
|||
catch
|
||||
{
|
||||
"Failed to read DCDC data".WriteLine();
|
||||
return new DcDcDevicesRecord(scStatus, Array.Empty<DcDcRecord>());
|
||||
return new DcDcDevicesRecord(null, Array.Empty<DcDcRecord>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue