first commit

This commit is contained in:
2025-04-07 07:44:27 -07:00
commit d6cde0c05e
512 changed files with 142392 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
// 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.Collections.Generic;
using System.Text;
using HidSharp;
namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer;
public class AquaComputerGroup : IGroup
{
private readonly List<IHardware> _hardware = new();
private readonly StringBuilder _report = new();
public AquaComputerGroup(ISettings settings)
{
_report.AppendLine("AquaComputer Hardware");
_report.AppendLine();
foreach (HidDevice dev in DeviceList.Local.GetHidDevices(0x0c70))
{
string productName = dev.GetProductName();
productName = productName.Substring(0, 1).ToUpper() + productName.Substring(1);
switch (dev.ProductID)
{
case 0xF00E:
var d5Next = new D5Next(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Firmware version: {d5Next.FirmwareVersion}");
_report.AppendLine();
_hardware.Add(d5Next);
break;
case 0xf0b6:
var aquastreamXt = new AquastreamXT(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Device variant: {aquastreamXt.Variant}");
_report.AppendLine($"Firmware version: {aquastreamXt.FirmwareVersion}");
_report.AppendLine($"{aquastreamXt.Status}");
_report.AppendLine();
_hardware.Add(aquastreamXt);
break;
case 0xf003:
var mps = new MPS(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Firmware version: {mps.FirmwareVersion}");
_report.AppendLine($"{mps.Status}");
_report.AppendLine();
_hardware.Add(mps);
break;
case 0xF00D:
var quadro = new Quadro(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Firmware version: {quadro.FirmwareVersion}");
_report.AppendLine();
_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}");
_report.AppendLine($"Firmware version: {octo.FirmwareVersion}");
_report.AppendLine();
_hardware.Add(octo);
break;
case 0xF00A:
var farbwerk = new Farbwerk(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Firmware version: {farbwerk.FirmwareVersion}");
_report.AppendLine($"{farbwerk.Status}");
_report.AppendLine();
_hardware.Add(farbwerk);
break;
case 0xF012:
var highflownext = new HighFlowNext(dev, settings);
_report.AppendLine($"Device name: {productName}");
_report.AppendLine($"Firmware version: {highflownext.FirmwareVersion}");
_report.AppendLine();
_hardware.Add(highflownext);
break;
default:
_report.AppendLine($"Unknown Hardware PID: {dev.ProductID} Name: {productName}");
_report.AppendLine();
break;
}
}
if (_hardware.Count == 0)
{
_report.AppendLine("No AquaComputer Hardware found.");
_report.AppendLine();
}
}
public IReadOnlyList<IHardware> Hardware => _hardware;
public void Close()
{
foreach (IHardware iHardware in _hardware)
{
if (iHardware is Hardware hardware)
hardware.Close();
}
}
public string GetReport()
{
return _report.ToString();
}
}

View File

@@ -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), 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<ParameterDescription>(), settings);
ActivateSensor(_temperatures[0]);
_temperatures[1] = new Sensor("External Sensor", 1, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[1]);
_rpmSensors[0] = new Sensor("Pump", 0, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[0]);
_voltages[0] = new Sensor("Pump", 0, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[0]);
_currents[0] = new Sensor("Pump", 0, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_currents[0]);
_powers[0] = new Sensor("Pump", 0, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_powers[0]);
// Initialize the flow sensor
_flows[0] = new Sensor("Pump", 0, SensorType.Flow, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_flows[0]);
_flows[1] = new Sensor("Pressure (mBar)", 1, SensorType.Factor, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_flows[1]);
_rpmSensors[1] = new Sensor("Fan", 1, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[1]);
_voltages[1] = new Sensor("Fan", 1, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[1]);
_currents[1] = new Sensor("Fan", 1, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_currents[1]);
_powers[1] = new Sensor("Fan", 1, SensorType.Power, this, Array.Empty<ParameterDescription>(), 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));
}
}

View File

@@ -0,0 +1,168 @@
// 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 System.Diagnostics.CodeAnalysis;
using System.IO;
using HidSharp;
namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer;
//TODO:
//Check tested and fix unknown variables in Update()
//Check if property "Variant" is valid interpreted
//Implement Fan Control in SetControl()
internal sealed class AquastreamXT : Hardware
{
private readonly Sensor _fanControl;
private readonly Sensor[] _frequencies = new Sensor[2];
private readonly Sensor _pumpFlow;
private readonly Sensor _pumpPower;
private readonly byte[] _rawData = new byte[64];
private readonly Sensor[] _rpmSensors = new Sensor[2];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[3];
private readonly Sensor[] _voltages = new Sensor[2];
public AquastreamXT(HidDevice dev, ISettings settings) : base("Aquastream XT", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
do
{
_rawData[0] = 0x4;
_stream.GetFeature(_rawData);
}
while (_rawData[0] != 0x4);
Name = $"Aquastream XT {Variant}";
FirmwareVersion = BitConverter.ToUInt16(_rawData, 50);
_temperatures[0] = new Sensor("External Fan VRM", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[0]);
_temperatures[1] = new Sensor("External", 1, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[1]);
_temperatures[2] = new Sensor("Internal Water", 2, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[2]);
_voltages[0] = new Sensor("External Fan", 1, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[0]);
_voltages[1] = new Sensor("Pump", 2, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[1]);
_pumpPower = new Sensor("Pump", 0, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_pumpPower);
_pumpFlow = new Sensor("Pump", 0, SensorType.Flow, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_pumpFlow);
_rpmSensors[0] = new Sensor("External Fan", 0, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[0]);
_rpmSensors[1] = new Sensor("Pump", 1, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[1]);
_fanControl = new Sensor("External Fan", 0, SensorType.Control, this, Array.Empty<ParameterDescription>(), settings);
_fanControl.Control = new Control(_fanControl, settings, 0, 100);
ActivateSensor(_fanControl);
_frequencies[0] = new Sensor("Pump Frequency", 0, SensorType.Frequency, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_frequencies[0]);
_frequencies[1] = new Sensor("Pump MaxFrequency", 1, SensorType.Frequency, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_frequencies[1]);
}
}
public ushort FirmwareVersion { get; private set; }
public override HardwareType HardwareType
{
get { return HardwareType.Cooler; }
}
public string Status
{
get
{
FirmwareVersion = BitConverter.ToUInt16(_rawData, 50);
return FirmwareVersion < 1008 ? $"Status: Untested Firmware Version {FirmwareVersion}! Please consider Updating to Version 1018" : "Status: OK";
}
}
//TODO: Check if valid
public string Variant
{
get
{
MODE mode = (MODE)_rawData[33];
if (mode.HasFlag(MODE.MODE_PUMP_ADV))
return "Ultra + Internal Flow Sensor";
if (mode.HasFlag(MODE.MODE_FAN_CONTROLLER))
return "Ultra";
if (mode.HasFlag(MODE.MODE_FAN_AMP))
return "Advanced";
return "Standard";
}
}
public override void Close()
{
_stream.Close();
base.Close();
}
//TODO: Check tested and fix unknown variables
public override void Update()
{
try
{
_rawData[0] = 0x4;
_stream.GetFeature(_rawData);
}
catch (IOException)
{
return;
}
if (_rawData[0] != 0x4)
return;
//var rawSensorsFan = BitConverter.ToUInt16(rawData, 1); //unknown - redundant?
//var rawSensorsExt = BitConverter.ToUInt16(rawData, 3); //unknown - redundant?
//var rawSensorsWater = BitConverter.ToUInt16(rawData, 5); //unknown - redundant?
_voltages[0].Value = BitConverter.ToUInt16(_rawData, 7) / 61f; //External Fan Voltage: tested - OK
_voltages[1].Value = BitConverter.ToUInt16(_rawData, 9) / 61f; //Pump Voltage: tested - OK
_pumpPower.Value = _voltages[1].Value * BitConverter.ToInt16(_rawData, 11) / 625f; //Pump Voltage * Pump Current: tested - OK
_temperatures[0].Value = BitConverter.ToUInt16(_rawData, 13) / 100f; //External Fan VRM Temperature: untested
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, 15) / 100f; //External Temperature Sensor: untested
_temperatures[2].Value = BitConverter.ToUInt16(_rawData, 17) / 100f; //Internal Water Temperature Sensor: tested - OK
_frequencies[0].Value = (1f / BitConverter.ToInt16(_rawData, 19)) * 750000; //Pump Frequency: tested - OK
_rpmSensors[1].Value = _frequencies[0].Value * 60f; //Pump RPM: tested - OK
_frequencies[1].Value = (1f / BitConverter.ToUInt16(_rawData, 21)) * 750000; //Pump Max Frequency: tested - OK
_pumpFlow.Value = BitConverter.ToUInt32(_rawData, 23); //Internal Pump Flow Sensor: unknown
_rpmSensors[0].Value = BitConverter.ToUInt32(_rawData, 27); //External Fan RPM: untested
_fanControl.Value = 100f / byte.MaxValue * _rawData[31]; //External Fan Control: tested, External Fan Voltage scales by this value - OK
}
[Flags]
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum MODE : byte
{
MODE_PUMP_ADV = 1,
MODE_FAN_AMP = 2,
MODE_FAN_CONTROLLER = 4
}
}

View File

@@ -0,0 +1,65 @@
// 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 D5Next : Hardware
{
//Available Reports, found them by looking at the below methods
//var test = dev.GetRawReportDescriptor();
//var test2 = dev.GetReportDescriptor();
// ID 1; Length 158; INPUT
// ID 2; Length 11; OUTPUT
// ID 3; Length 1025; <-- works FEATURE
// ID 8; Length 1025; <-- works FEATURE
// ID 12; Length 1025; <-- 0xC FEATURE
private readonly byte[] _rawData = new byte[1025];
private readonly Sensor[] _rpmSensors = new Sensor[1];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[1];
public D5Next(HidDevice dev, ISettings settings) : base("D5Next", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
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]);
_rpmSensors[0] = new Sensor("Pump", 0, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[0]);
}
}
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);
_temperatures[0].Value = (_rawData[88] | (_rawData[87] << 8)) / 100f; //Water Temp
_rpmSensors[0].Value = _rawData[117] | (_rawData[116] << 8); //Pump RPM
}
}

View File

@@ -0,0 +1,115 @@
// 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;
//TODO:
//Implement set RGB Controls
internal sealed class Farbwerk : Hardware
{
private const int FEATURE_ID = 3;
private const int HEADER_SIZE = 27;
private const int SENSOR_OFFSET = 20;
private const int COLORS_OFFSET = 40;
private const int TEMPERATURE_COUNT = 4;
private const int COLOR_COUNT = 4;
private const int COLOR_VALUE_COUNT = COLOR_COUNT * 3;
private readonly byte[] _rawData = new byte[140];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[TEMPERATURE_COUNT];
private readonly Sensor[] _colors = new Sensor[COLOR_VALUE_COUNT];
public Farbwerk(HidDevice dev, ISettings settings) : base("Farbwerk", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
for (int i = 0; i < _temperatures.Length; i++)
{
_temperatures[i] = new Sensor($"Sensor {i + 1}", i, SensorType.Temperature, this, settings);
ActivateSensor(_temperatures[i]);
}
for (int i = 0; i < _colors.Length; i++)
{
int control = (i / 3) + 1;
string color = (i % 3) switch
{
0 => "Red",
1 => "Green",
2 => "Blue",
_ => "Invalid"
};
_colors[i] = new Sensor($"Controller {control} {color}", COLOR_COUNT + i, SensorType.Level, this, settings);
ActivateSensor(_colors[i]);
}
Update();
}
}
public ushort FirmwareVersion { get; private set; }
public override HardwareType HardwareType
{
get { return HardwareType.EmbeddedController; }
}
public string Status
{
get
{
if (_rawData[0] != 0x1)
{
return $"Status: Invalid header {_rawData[0]}";
}
if (FirmwareVersion < 1009)
{
return $"Status: Untested Firmware Version {FirmwareVersion}! Please consider Updating to Version 1009";
}
return "Status: OK";
}
}
public override void Close()
{
_stream.Close();
base.Close();
}
public override void Update()
{
int length = _stream.Read(_rawData);
if (length != _rawData.Length || _rawData[0] != 0x1)
{
return;
}
FirmwareVersion = Convert.ToUInt16(_rawData[21] << 8 | _rawData[22]);
int offset = HEADER_SIZE + SENSOR_OFFSET;
for (int i = 0; i < _temperatures.Length; i++)
{
_temperatures[i].Value = (_rawData[offset] << 8 | _rawData[offset + 1]) / 100.0f;
offset += 2;
}
offset = HEADER_SIZE + COLORS_OFFSET;
for (int i = 0; i < _colors.Length; i++)
{
_colors[i].Value = (_rawData[offset] << 8 | _rawData[offset + 1]) / 81.90f;
offset += 2;
}
}
}

View File

@@ -0,0 +1,139 @@
// 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 HighFlowNext : Hardware
{
private readonly byte[] _rawData = new byte[1025];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[2];
private readonly Sensor[] _flows = new Sensor[1];
private readonly Sensor[] _levels = new Sensor[1];
private readonly Sensor[] _powers = new Sensor[1];
private readonly Sensor[] _conductivities = new Sensor[1];
private readonly Sensor[] _voltages = new Sensor[2];
private readonly Sensor[] _alarms = new Sensor[4];
public HighFlowNext(HidDevice dev, ISettings settings) : base("high flow NEXT", new Identifier(dev), 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 = ReadUInt16BE(_rawData, 13);
_temperatures[0] = new Sensor("Water Temperature", 0, SensorType.Temperature, this, settings);
ActivateSensor(_temperatures[0]);
_temperatures[1] = new Sensor("External Temperature", 1, SensorType.Temperature, this, settings);
ActivateSensor(_temperatures[1]);
_flows[0] = new Sensor("Flow", 0, SensorType.Flow, this, settings);
ActivateSensor(_flows[0]);
_levels[0] = new Sensor("Water Quality", 0, SensorType.Level, this, settings);
ActivateSensor(_levels[0]);
_powers[0] = new Sensor("Dissipated Power", 0, SensorType.Power, this, settings);
ActivateSensor(_powers[0]);
_conductivities[0] = new Sensor("Conductivity", 0, SensorType.Conductivity, this, settings);
ActivateSensor(_conductivities[0]);
_voltages[0] = new Sensor("VCC", 0, SensorType.Voltage, this, settings);
ActivateSensor(_voltages[0]);
_voltages[1] = new Sensor("VCC USB", 1, SensorType.Voltage, this, settings);
ActivateSensor(_voltages[1]);
_alarms[0] = new Sensor("Flow Alarm", 0, true, SensorType.Factor, this, null, settings);
ActivateSensor(_alarms[0]);
_alarms[1] = new Sensor("Water Temperature Alarm", 1, true, SensorType.Factor, this, null, settings);
ActivateSensor(_alarms[0]);
_alarms[2] = new Sensor("External Temperature Alarm", 2, true, SensorType.Factor, this, null, settings);
ActivateSensor(_alarms[0]);
_alarms[3] = new Sensor("Water Quality Alarm", 3, true, SensorType.Factor, this, null, settings);
ActivateSensor(_alarms[0]);
}
}
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);
_temperatures[0].Value = ReadUInt16BE(_rawData, 85) / 100f; // Water Temperature
// External Temperature.
ushort rawExtTempValue = ReadUInt16BE(_rawData, 87);
bool externalTempSensorConnected = rawExtTempValue != short.MaxValue;
if (externalTempSensorConnected)
{
_temperatures[1].Value = rawExtTempValue / 100f;
}
else
{
// No external temp sensor connected.
_temperatures[1].Value = null;
}
_flows[0].Value = ReadUInt16BE(_rawData, 81) / 10f; // Flow
_levels[0].Value = ReadUInt16BE(_rawData, 89) / 100f; // Water Quality
// Dissipated Power.
if (externalTempSensorConnected)
{
_powers[0].Value = ReadUInt16BE(_rawData, 91);
}
else
{
// Power calculation requires the external temp sensor to be connected.
_powers[0].Value = null;
}
_conductivities[0].Value = ReadUInt16BE(_rawData, 95) / 10f; // Conductivity
_voltages[0].Value = ReadUInt16BE(_rawData, 97) / 100f; // VCC
_voltages[1].Value = ReadUInt16BE(_rawData, 99) / 100f; // VCC USB
_alarms[0].Value = (_rawData[116] & 0x02) >> 1; // Flow alarm
_alarms[1].Value = (_rawData[116] & 0x04) >> 2; // Water temperature alarm
_alarms[2].Value = (_rawData[116] & 0x08) >> 3; // External temperature alarm
_alarms[3].Value = (_rawData[116] & 0x10) >> 4; // Water quality alarm
// Unused:
// _rawData[101..104] -> Total pumped volume liters
// _rawData[105..109] -> Internal impulse counter from flow meter
}
private ushort ReadUInt16BE(byte[] value, int startIndex)
{
return (ushort)(value[startIndex + 1] | (value[startIndex] << 8));
}
}

View File

@@ -0,0 +1,114 @@
// 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 System.IO;
using HidSharp;
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;
private readonly byte[] _rawData = new byte[64];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[2];
private ushort _externalTemperature;
public MPS(HidDevice dev, ISettings settings) : base("MPS", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
do
{
_rawData[0] = MPS_REPORT_ID;
_stream.GetFeature(_rawData);
}
while (_rawData[0] != MPS_REPORT_ID);
Name = "MPS";
FirmwareVersion = ExtractFirmwareVersion();
_temperatures[0] = new Sensor("External", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[0]);
_temperatures[1] = new Sensor("Internal Water", 1, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[1]);
_pumpFlow = new Sensor("Pump", 0, SensorType.Flow, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_pumpFlow);
}
}
public ushort FirmwareVersion { get; private set; }
public override HardwareType HardwareType
{
get { return HardwareType.Cooler; }
}
public string Status
{
get
{
FirmwareVersion = ExtractFirmwareVersion();
if (FirmwareVersion < 1012)
{
return $"Status: Untested Firmware Version {FirmwareVersion}! Please consider Updating to Version 1012";
}
return "Status: OK";
}
}
public override void Close()
{
_stream.Close();
base.Close();
}
public override void Update()
{
try
{
_rawData[0] = MPS_REPORT_ID;
_stream.GetFeature(_rawData);
}
catch (IOException)
{
return;
}
if (_rawData[0] != MPS_REPORT_ID)
return;
_pumpFlow.Value = BitConverter.ToUInt16(_rawData, PumpFlow) / 10f;
_externalTemperature = BitConverter.ToUInt16(_rawData, ExternalTemperature);
//sensor reading returns Int16.MaxValue (32767), when not connected
if (_externalTemperature != short.MaxValue)
{
_temperatures[0].Value = _externalTemperature / 100f;
}
else
{
_temperatures[0].Value = null;
}
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, InternalWaterTemperature) / 100f;
}
private ushort ExtractFirmwareVersion()
{
return BitConverter.ToUInt16(_rawData, 3);
}
}

View File

@@ -0,0 +1,187 @@
// 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 Octo : Hardware
{
private readonly byte[] _rawData = new byte[1025];
private readonly Sensor[] _rpmSensors = new Sensor[8];
private readonly HidStream _stream;
private readonly Sensor[] _temperatures = new Sensor[4];
private readonly Sensor[] _voltages = new Sensor[9];
private readonly Sensor[] _currents = new Sensor[8];
private readonly Sensor[] _powers = new Sensor[8];
public Octo(HidDevice dev, ISettings settings) : base("Octo", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
Name = "OCTO";
FirmwareVersion = GetConvertedValue(OctoDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
// Initialize the 4 temperature sensors
for (int i = 0; i < 4; i++)
{
_temperatures[i] = new Sensor($"Temperature {i + 1}", i, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[i]);
}
// Initialize the 8 fan speed sensors
for (int i = 0; i < 8; i++)
{
_rpmSensors[i] = new Sensor($"Fan {i + 1}", i, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[i]);
}
// Initialize the input voltage sensor
_voltages[0] = new Sensor("Input", 0, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[0]);
// Initialize the 8 fan voltage sensors
for (int i = 1; i < 9; i++)
{
_voltages[i] = new Sensor($"Fan {i}", i, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[i]);
}
// Initialize the 8 fan current sensors
for (int i = 0; i < 8; i++)
{
_currents[i] = new Sensor($"Fan {i + 1}", i, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_currents[i]);
}
// Initialize the 8 fan power sensors
for (int i = 0; i < 8; i++)
{
_powers[i] = new Sensor($"Fan {i + 1}", i, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_powers[i]);
}
}
}
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);
_temperatures[0].Value = GetConvertedValue(OctoDataIndexes.TEMP_1) / 100f; // Temp 1
_temperatures[1].Value = GetConvertedValue(OctoDataIndexes.TEMP_2) / 100f; // Temp 2
_temperatures[2].Value = GetConvertedValue(OctoDataIndexes.TEMP_3) / 100f; // Temp 3
_temperatures[3].Value = GetConvertedValue(OctoDataIndexes.TEMP_4) / 100f; // Temp 4
_rpmSensors[0].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_1); // Fan 1 speed
_rpmSensors[1].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_2); // Fan 2 speed
_rpmSensors[2].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_3); // Fan 3 speed
_rpmSensors[3].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_4); // Fan 4 speed
_rpmSensors[4].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_5); // Fan 5 speed
_rpmSensors[5].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_6); // Fan 6 speed
_rpmSensors[6].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_7); // Fan 7 speed
_rpmSensors[7].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_8); // Fan 8 speed
_voltages[0].Value = GetConvertedValue(OctoDataIndexes.VOLTAGE) / 100f; // Input voltage
_voltages[1].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_1) / 100f; // Fan 1 voltage
_voltages[2].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_2) / 100f; // Fan 2 voltage
_voltages[3].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_3) / 100f; // Fan 3 voltage
_voltages[4].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_4) / 100f; // Fan 4 voltage
_voltages[5].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_5) / 100f; // Fan 5 voltage
_voltages[6].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_6) / 100f; // Fan 6 voltage
_voltages[7].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_7) / 100f; // Fan 7 voltage
_voltages[8].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_8) / 100f; // Fan 8 voltage
_currents[0].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_1) / 1000f; // Fan 1 current
_currents[1].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_2) / 1000f; // Fan 2 current
_currents[2].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_3) / 1000f; // Fan 3 current
_currents[3].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_4) / 1000f; // Fan 4 current
_currents[4].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_5) / 1000f; // Fan 5 current
_currents[5].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_6) / 1000f; // Fan 6 current
_currents[6].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_7) / 1000f; // Fan 7 current
_currents[7].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_8) / 1000f; // Fan 8 current
_powers[0].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_1) / 100f; // Fan 1 power
_powers[1].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_2) / 100f; // Fan 2 power
_powers[2].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_3) / 100f; // Fan 3 power
_powers[3].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_4) / 100f; // Fan 4 power
_powers[4].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_5) / 100f; // Fan 5 power
_powers[5].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_6) / 100f; // Fan 6 power
_powers[6].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_7) / 100f; // Fan 7 power
_powers[7].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_8) / 100f; // Fan 8 power
}
private sealed class OctoDataIndexes
{
public const int FIRMWARE_VERSION = 13;
public const int TEMP_1 = 61;
public const int TEMP_2 = 63;
public const int TEMP_3 = 65;
public const int TEMP_4 = 67;
public const int FAN_SPEED_1 = 133;
public const int FAN_SPEED_2 = 146;
public const int FAN_SPEED_3 = 159;
public const int FAN_SPEED_4 = 172;
public const int FAN_SPEED_5 = 185;
public const int FAN_SPEED_6 = 198;
public const int FAN_SPEED_7 = 211;
public const int FAN_SPEED_8 = 224;
public const int FAN_POWER_1 = 131;
public const int FAN_POWER_2 = 144;
public const int FAN_POWER_3 = 157;
public const int FAN_POWER_4 = 170;
public const int FAN_POWER_5 = 183;
public const int FAN_POWER_6 = 196;
public const int FAN_POWER_7 = 209;
public const int FAN_POWER_8 = 222;
public const int VOLTAGE = 117;
public const int FAN_VOLTAGE_1 = 127;
public const int FAN_VOLTAGE_2 = 140;
public const int FAN_VOLTAGE_3 = 153;
public const int FAN_VOLTAGE_4 = 166;
public const int FAN_VOLTAGE_5 = 179;
public const int FAN_VOLTAGE_6 = 192;
public const int FAN_VOLTAGE_7 = 205;
public const int FAN_VOLTAGE_8 = 218;
public const int FAN_CURRENT_1 = 129;
public const int FAN_CURRENT_2 = 142;
public const int FAN_CURRENT_3 = 155;
public const int FAN_CURRENT_4 = 168;
public const int FAN_CURRENT_5 = 181;
public const int FAN_CURRENT_6 = 194;
public const int FAN_CURRENT_7 = 207;
public const int FAN_CURRENT_8 = 220;
}
private ushort? GetConvertedValue(int index)
{
if (_rawData[index] == sbyte.MaxValue)
return null;
return Convert.ToUInt16(_rawData[index + 1] | (_rawData[index] << 8));
}
}

View File

@@ -0,0 +1,170 @@
// 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 Quadro : Hardware
{
private readonly byte[] _rawData = new byte[210];
private readonly HidStream _stream;
private readonly Sensor[] _rpmSensors = new Sensor[4];
private readonly Sensor[] _temperatures = new Sensor[4];
private readonly Sensor[] _voltages = new Sensor[5];
private readonly Sensor[] _currents = new Sensor[4];
private readonly Sensor[] _powers = new Sensor[4];
private readonly Sensor[] _flows = new Sensor[1];
public Quadro(HidDevice dev, ISettings settings) : base("Quadro", new Identifier(dev), settings)
{
if (dev.TryOpen(out _stream))
{
//Reading output report instead of feature report, as the measurements are in the output report
_stream.Read(_rawData);
Name = "QUADRO";
FirmwareVersion = GetConvertedValue(QuadroDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
// Initialize the 4 temperature sensors
for (int i = 0; i < 4; i++)
{
_temperatures[i] = new Sensor($"Temperature {i + 1}", i, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_temperatures[i]);
}
// Initialize the input voltage sensor
_voltages[0] = new Sensor("Input", 0, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[0]);
// Initialize the flow sensor
_flows[0] = new Sensor("Flow", 0, SensorType.Flow, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_flows[0]);
// Initialize the 4 fan voltage sensors
for (int i = 1; i < 5; i++)
{
_voltages[i] = new Sensor($"Fan {i}", i, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_voltages[i]);
}
// Initialize the 4 fan current sensors
for (int i = 0; i < 4; i++)
{
_currents[i] = new Sensor($"Fan {i + 1}", i, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_currents[i]);
}
// Initialize the 4 fan power sensors
for (int i = 0; i < 4; i++)
{
_powers[i] = new Sensor($"Fan {i + 1}", i, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_powers[i]);
}
// Initialize the 4 fan speed sensors
for (int i = 0; i < 4; i++)
{
_rpmSensors[i] = new Sensor($"Fan {i + 1}", i, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
ActivateSensor(_rpmSensors[i]);
}
}
}
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);
_temperatures[0].Value = GetConvertedValue(QuadroDataIndexes.TEMP_1) / 100f; // Temp 1
_temperatures[1].Value = GetConvertedValue(QuadroDataIndexes.TEMP_2) / 100f; // Temp 2
_temperatures[2].Value = GetConvertedValue(QuadroDataIndexes.TEMP_3) / 100f; // Temp 3
_temperatures[3].Value = GetConvertedValue(QuadroDataIndexes.TEMP_4) / 100f; // Temp 4
_voltages[0].Value = GetConvertedValue(QuadroDataIndexes.VOLTAGE) / 100f; // Input voltage
_flows[0].Value = GetConvertedValue(QuadroDataIndexes.FLOW) / 10f; // Flow
_voltages[1].Value = GetConvertedValue(QuadroDataIndexes.FAN_VOLTAGE_1) / 100f; // Fan 1 voltage
_voltages[2].Value = GetConvertedValue(QuadroDataIndexes.FAN_VOLTAGE_2) / 100f; // Fan 2 voltage
_voltages[3].Value = GetConvertedValue(QuadroDataIndexes.FAN_VOLTAGE_3) / 100f; // Fan 3 voltage
_voltages[4].Value = GetConvertedValue(QuadroDataIndexes.FAN_VOLTAGE_4) / 100f; // Fan 4 voltage
_currents[0].Value = GetConvertedValue(QuadroDataIndexes.FAN_CURRENT_1) / 1000f; // Fan 1 current
_currents[1].Value = GetConvertedValue(QuadroDataIndexes.FAN_CURRENT_2) / 1000f; // Fan 2 current
_currents[2].Value = GetConvertedValue(QuadroDataIndexes.FAN_CURRENT_3) / 1000f; // Fan 3 current
_currents[3].Value = GetConvertedValue(QuadroDataIndexes.FAN_CURRENT_4) / 1000f; // Fan 4 current
_powers[0].Value = GetConvertedValue(QuadroDataIndexes.FAN_POWER_1) / 100f; // Fan 1 power
_powers[1].Value = GetConvertedValue(QuadroDataIndexes.FAN_POWER_2) / 100f; // Fan 2 power
_powers[2].Value = GetConvertedValue(QuadroDataIndexes.FAN_POWER_3) / 100f; // Fan 3 power
_powers[3].Value = GetConvertedValue(QuadroDataIndexes.FAN_POWER_4) / 100f; // Fan 4 power
_rpmSensors[0].Value = GetConvertedValue(QuadroDataIndexes.FAN_SPEED_1); // Fan 1 speed
_rpmSensors[1].Value = GetConvertedValue(QuadroDataIndexes.FAN_SPEED_2); // Fan 2 speed
_rpmSensors[2].Value = GetConvertedValue(QuadroDataIndexes.FAN_SPEED_3); // Fan 3 speed
_rpmSensors[3].Value = GetConvertedValue(QuadroDataIndexes.FAN_SPEED_4); // Fan 4 speed
}
private sealed class QuadroDataIndexes
{
public const int FIRMWARE_VERSION = 13;
public const int TEMP_1 = 52;
public const int TEMP_2 = 54;
public const int TEMP_3 = 56;
public const int TEMP_4 = 58;
public const int VOLTAGE = 108;
public const int FLOW = 110;
public const int FAN_VOLTAGE_1 = 114;
public const int FAN_VOLTAGE_2 = 127;
public const int FAN_VOLTAGE_3 = 140;
public const int FAN_VOLTAGE_4 = 153;
public const int FAN_CURRENT_1 = 116;
public const int FAN_CURRENT_2 = 129;
public const int FAN_CURRENT_3 = 142;
public const int FAN_CURRENT_4 = 155;
public const int FAN_POWER_1 = 118;
public const int FAN_POWER_2 = 131;
public const int FAN_POWER_3 = 144;
public const int FAN_POWER_4 = 157;
public const int FAN_SPEED_1 = 120;
public const int FAN_SPEED_2 = 133;
public const int FAN_SPEED_3 = 146;
public const int FAN_SPEED_4 = 159;
}
private ushort? GetConvertedValue(int index)
{
if (_rawData[index] == sbyte.MaxValue)
return null;
return Convert.ToUInt16(_rawData[index + 1] | (_rawData[index] << 8));
}
}