Fix some code analysis issues (#841)

This commit is contained in:
PhyxionNL
2022-10-09 13:16:31 +02:00
committed by GitHub
parent 90b6c2025c
commit 3ac329f247
53 changed files with 419 additions and 514 deletions
@@ -32,7 +32,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
Name = $"D5Next";
Name = "D5Next";
FirmwareVersion = Convert.ToUInt16(_rawData[14] | (_rawData[13] << 8));
_temperatures[0] = new Sensor("Water Temperature", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[0]);
@@ -60,7 +60,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
_temperatures[0].Value = (_rawData[88] | (_rawData[87] << 8)) / 100f; //Water Temp
_rpmSensors[0].Value = (_rawData[117] | (_rawData[116] << 8)); //Pump RPM
_rpmSensors[0].Value = _rawData[117] | (_rawData[116] << 8); //Pump RPM
}
}
}
@@ -10,6 +10,9 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
{
internal sealed class MPS : Hardware
{
public const int ExternalTemperature = 43;
public const int InternalWaterTemperature = 45;
public const int PumpFlow = 35;
private const byte MPS_REPORT_ID = 0x2;
private readonly Sensor _pumpFlow;
@@ -79,9 +82,9 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
if (_rawData[0] != MPS_REPORT_ID)
return;
_pumpFlow.Value = BitConverter.ToUInt16(_rawData, MPSDataIndexes.PumpFlow) / 10f;
_pumpFlow.Value = BitConverter.ToUInt16(_rawData, PumpFlow) / 10f;
_externalTemperature = BitConverter.ToUInt16(_rawData, MPSDataIndexes.ExternalTemperature);
_externalTemperature = BitConverter.ToUInt16(_rawData, ExternalTemperature);
//sensor reading returns Int16.MaxValue (32767), when not connected
if (_externalTemperature != short.MaxValue)
{
@@ -92,19 +95,12 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
_temperatures[0].Value = null;
}
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, MPSDataIndexes.InternalWaterTemperature) / 100f;
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, InternalWaterTemperature) / 100f;
}
private ushort ExtractFirmwareVersion()
{
return BitConverter.ToUInt16(_rawData, 3);
}
private sealed class MPSDataIndexes
{
public const int ExternalTemperature = 43;
public const int InternalWaterTemperature = 45;
public const int PumpFlow = 35;
}
}
}
@@ -25,7 +25,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
Name = $"OCTO";
Name = "OCTO";
FirmwareVersion = GetConvertedValue(OctoDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
// Initialize the 4 temperature sensors