From 874384851d3f695a4aed1bbf2ea9a918962dc7dd Mon Sep 17 00:00:00 2001
From: Evan Mulawski <1044791+EvanMulawski@users.noreply.github.com>
Date: Thu, 11 Jul 2024 21:07:05 -0400
Subject: [PATCH] [icue-link] add support for XD5 pump
---
README.md | 2 ++
src/devices/icue_link/ICueLinkHubDevice.cs | 4 ++--
src/devices/icue_link/KnownLinkDevice.cs | 3 +++
src/devices/icue_link/KnownLinkDevices.cs | 2 ++
.../ICueLink/LinkHubDataReaderTests.cs | 19 +++++++++++++++++++
5 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 9f2b14a..2c351e0 100644
--- a/README.md
+++ b/README.md
@@ -127,6 +127,8 @@ Support for the iCUE LINK Hub was added in v1.5.0. The following LINK devices ar
| H150i (White) | `07` | `05` | Full Support | ✅ | ✅ 1 | ✅ |
| XC7 (Stealth Gray) | `09` | `00` | Full Support | n/a | n/a | ✅ |
| XC7 (White) | `09` | `01` | Full Support | n/a | n/a | ✅ |
+| XD5 (Stealth Gray) | `0c` | `00` | Full Support | ✅ | ✅ 1 | ✅ |
+| XD5 (White) | `0c` | `01` | Full Support | ✅ | ✅ 1 | ✅ |
| RX RGB Fan | `0f` | `00` | Full Support | ✅ | ✅ | n/a |
| RX Fan | `13` | `00` | Full Support | ✅ | ✅ | n/a |
diff --git a/src/devices/icue_link/ICueLinkHubDevice.cs b/src/devices/icue_link/ICueLinkHubDevice.cs
index 52f7396..8c4d507 100644
--- a/src/devices/icue_link/ICueLinkHubDevice.cs
+++ b/src/devices/icue_link/ICueLinkHubDevice.cs
@@ -186,7 +186,7 @@ private void InitializeChannels(EndpointResponse subDevicesResponse)
public override void SetChannelPower(int channel, int percent)
{
var clampMin = PERCENT_MIN;
- if (_channels[channel].KnownDevice.Type == LinkDeviceType.LiquidCooler)
+ if (_channels[channel].KnownDevice.IsPump)
{
clampMin = _pumpPowerMinimum;
}
@@ -197,7 +197,7 @@ public override void SetChannelPower(int channel, int percent)
public override void ResetChannel(int channel)
{
var value = DEFAULT_SPEED_CHANNEL_POWER;
- if (_channels[channel].KnownDevice.Type == LinkDeviceType.LiquidCooler)
+ if (_channels[channel].KnownDevice.IsPump)
{
value = DEFAULT_SPEED_CHANNEL_POWER_PUMP;
}
diff --git a/src/devices/icue_link/KnownLinkDevice.cs b/src/devices/icue_link/KnownLinkDevice.cs
index d7bd6fa..41d1cd0 100644
--- a/src/devices/icue_link/KnownLinkDevice.cs
+++ b/src/devices/icue_link/KnownLinkDevice.cs
@@ -14,6 +14,8 @@ public KnownLinkDevice(LinkDeviceType type, byte model, string name, LinkDeviceF
public byte Model { get; }
public string Name { get; }
public LinkDeviceFlags Flags { get; }
+
+ public bool IsPump => Type == LinkDeviceType.LiquidCooler || Type == LinkDeviceType.Pump;
}
public enum LinkDeviceType : byte
@@ -21,6 +23,7 @@ public enum LinkDeviceType : byte
FanQxSeries = 0x01,
LiquidCooler = 0x07,
WaterBlock = 0x09,
+ Pump = 0x0c,
FanRxRgbSeries = 0x0f,
FanRxSeries = 0x13,
}
diff --git a/src/devices/icue_link/KnownLinkDevices.cs b/src/devices/icue_link/KnownLinkDevices.cs
index c262646..52f30df 100644
--- a/src/devices/icue_link/KnownLinkDevices.cs
+++ b/src/devices/icue_link/KnownLinkDevices.cs
@@ -18,6 +18,8 @@ static KnownLinkDevices()
_devices.Add(new KnownLinkDevice(LinkDeviceType.WaterBlock, 0x01, "XC7", LinkDeviceFlags.ReportsTemperature)); // white
_devices.Add(new KnownLinkDevice(LinkDeviceType.FanRxSeries, 0x00, "RX Fan", LinkDeviceFlags.ControlsSpeed | LinkDeviceFlags.ReportsSpeed));
_devices.Add(new KnownLinkDevice(LinkDeviceType.FanRxRgbSeries, 0x00, "RX RGB Fan", LinkDeviceFlags.ControlsSpeed | LinkDeviceFlags.ReportsSpeed));
+ _devices.Add(new KnownLinkDevice(LinkDeviceType.Pump, 0x00, "XD5", LinkDeviceFlags.ReportsTemperature | LinkDeviceFlags.ReportsSpeed)); // stealth gray
+ _devices.Add(new KnownLinkDevice(LinkDeviceType.Pump, 0x01, "XD5", LinkDeviceFlags.All)); // white
_deviceLookup = InitializeDeviceLookup();
}
diff --git a/test/CorsairLink.Tests/ICueLink/LinkHubDataReaderTests.cs b/test/CorsairLink.Tests/ICueLink/LinkHubDataReaderTests.cs
index 8fa5b65..e3a672a 100644
--- a/test/CorsairLink.Tests/ICueLink/LinkHubDataReaderTests.cs
+++ b/test/CorsairLink.Tests/ICueLink/LinkHubDataReaderTests.cs
@@ -49,6 +49,25 @@ public void GetDevices_ReturnsAllSubDevices__3()
Assert.Equal(0x00, devices.OnChannel(8).Model);
}
+ [Fact]
+ public void GetDevices_ReturnsAllSubDevices__4()
+ {
+ // Arrange
+ var data = TestUtils.ParseHexString("0000080021000d00000c000000051a303130303041303036313034363130463536303030303341364400000e00000005183433304341443539464632384145344133383530433932450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000051a303130303337423930323033353939354430303030303138393800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
+
+ // Act
+ var devices = LinkHubDataReader.GetDevices(data);
+
+ // Assert
+ Assert.Equal(3, devices.Count);
+ Assert.Equal(0x0c, devices.OnChannel(1).Type);
+ Assert.Equal(0x00, devices.OnChannel(1).Model);
+ Assert.Equal(0x0e, devices.OnChannel(2).Type);
+ Assert.Equal(0x00, devices.OnChannel(2).Model);
+ Assert.Equal(0x09, devices.OnChannel(13).Type);
+ Assert.Equal(0x00, devices.OnChannel(13).Model);
+ }
+
[Fact]
public void GetFirmwareVersion_ReturnsHumanReadableVersionString()
{