diff --git a/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquaComputerGroup.cs b/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquaComputerGroup.cs index 9a4e054..c753063 100644 --- a/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquaComputerGroup.cs +++ b/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquaComputerGroup.cs @@ -61,6 +61,14 @@ public class AquaComputerGroup : IGroup _hardware.Add(quadro); break; + case 0xF00B: + var aquastreamUltimate = new AquastreamUltimate(dev, settings); + _report.AppendLine($"Device name: {productName}"); + _report.AppendLine($"Firmware version: {aquastreamUltimate.FirmwareVersion}"); + _report.AppendLine(); + _hardware.Add(aquastreamUltimate); + break; + case 0xF011: var octo = new Octo(dev, settings); _report.AppendLine($"Device name: {productName}"); diff --git a/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquastreamUltimate.cs b/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquastreamUltimate.cs new file mode 100644 index 0000000..6534519 --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquastreamUltimate.cs @@ -0,0 +1,117 @@ +// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// Copyright (C) LibreHardwareMonitor and Contributors. +// All Rights Reserved. + +using System; +using HidSharp; + +namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer; + +internal sealed class AquastreamUltimate : Hardware +{ + private readonly byte[] _rawData = new byte[104]; + private readonly HidStream _stream; + + private readonly Sensor[] _rpmSensors = new Sensor[2]; + private readonly Sensor[] _temperatures = new Sensor[2]; + private readonly Sensor[] _voltages = new Sensor[2]; + private readonly Sensor[] _currents = new Sensor[2]; + private readonly Sensor[] _powers = new Sensor[2]; + private readonly Sensor[] _flows = new Sensor[2]; + + public AquastreamUltimate(HidDevice dev, ISettings settings) : base("AquastreamUltimate", new Identifier(dev.DevicePath), settings) + { + if (dev.TryOpen(out _stream)) + { + // Reading output report instead of feature report, as the measurements are in the output report. + _stream.Read(_rawData); + + FirmwareVersion = GetConvertedValue(0xD).GetValueOrDefault(0); + + Name = "Aquastream ULTIMATE"; + + _temperatures[0] = new Sensor("Coolant", 0, SensorType.Temperature, this, Array.Empty(), settings); + ActivateSensor(_temperatures[0]); + + _temperatures[1] = new Sensor("External Sensor", 1, SensorType.Temperature, this, Array.Empty(), settings); + ActivateSensor(_temperatures[1]); + + _rpmSensors[0] = new Sensor("Pump", 0, SensorType.Fan, this, Array.Empty(), settings); + ActivateSensor(_rpmSensors[0]); + + _voltages[0] = new Sensor("Pump", 0, SensorType.Voltage, this, Array.Empty(), settings); + ActivateSensor(_voltages[0]); + + _currents[0] = new Sensor("Pump", 0, SensorType.Current, this, Array.Empty(), settings); + ActivateSensor(_currents[0]); + + _powers[0] = new Sensor("Pump", 0, SensorType.Power, this, Array.Empty(), settings); + ActivateSensor(_powers[0]); + + // Initialize the flow sensor + _flows[0] = new Sensor("Pump", 0, SensorType.Flow, this, Array.Empty(), settings); + ActivateSensor(_flows[0]); + + _flows[1] = new Sensor("Pressure (mBar)", 1, SensorType.Factor, this, Array.Empty(), settings); + ActivateSensor(_flows[1]); + + _rpmSensors[1] = new Sensor("Fan", 1, SensorType.Fan, this, Array.Empty(), settings); + ActivateSensor(_rpmSensors[1]); + + _voltages[1] = new Sensor("Fan", 1, SensorType.Voltage, this, Array.Empty(), settings); + ActivateSensor(_voltages[1]); + + _currents[1] = new Sensor("Fan", 1, SensorType.Current, this, Array.Empty(), settings); + ActivateSensor(_currents[1]); + + _powers[1] = new Sensor("Fan", 1, SensorType.Power, this, Array.Empty(), settings); + ActivateSensor(_powers[1]); + } + } + + public ushort FirmwareVersion { get; } + + public override HardwareType HardwareType + { + get { return HardwareType.Cooler; } + } + + public override void Close() + { + _stream.Close(); + base.Close(); + } + + public override void Update() + { + // Reading output report instead of feature report, as the measurements are in the output report + _stream.Read(_rawData); + + _rpmSensors[0].Value = GetConvertedValue(0x51) ; // Pump speed. + _rpmSensors[1].Value = GetConvertedValue(0x41+0x06); // Fan speed. + + _temperatures[0].Value = GetConvertedValue(0x2D) / 100f; // Water temp. + _temperatures[1].Value = GetConvertedValue(0x2F) / 100f; / /Ext sensor temp. + + _voltages[0].Value = GetConvertedValue(0x3D) / 100f; // Pump input voltage. + _voltages[1].Value = GetConvertedValue(0x41+0x02) / 100f; // Fan output voltage. + + _currents[0].Value = GetConvertedValue(0x53) / 1000f; // Pump current. + _currents[1].Value = GetConvertedValue(0x41+0x00) / 1000f; // Fan current. + + _powers[0].Value = GetConvertedValue(0x55) / 100f; // Pump power. + _powers[1].Value = GetConvertedValue(0x41+0x04) / 100f; // Fan power. + + _flows[0].Value = GetConvertedValue(0x37); // Flow. + _flows[1].Value = GetConvertedValue(0x57) / 1000f; // Pressure. + } + + private ushort? GetConvertedValue(int index) + { + if (_rawData[index] == sbyte.MaxValue) + return null; + + return Convert.ToUInt16(_rawData[index + 1] | (_rawData[index] << 8)); + } +}