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()
|
public DcDcDevicesRecord Read()
|
||||||
{
|
{
|
||||||
SystemControlRegisters? scStatus;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scStatus = _SystemControl.Read();
|
var scStatus = _SystemControl.Read();
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
return DcDcDevicesRecord.Null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var n = scStatus.NumberOfConnectedSlaves;
|
var n = scStatus.NumberOfConnectedSlaves;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dcDcRecords = _DcDcs
|
var dcDcRecords = _DcDcs
|
||||||
.Take(n)
|
.Take(n)
|
||||||
.Select(dcdc => dcdc.Read())
|
.Select(dcdc => dcdc.Read())
|
||||||
|
@ -61,7 +51,7 @@ public class TruConvertDcDcDevices
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
"Failed to read DCDC data".WriteLine();
|
"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