1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00

Fixed detection for corsair-cooler

Fixes #47
This commit is contained in:
Darth Affe 2019-02-15 17:10:11 +01:00
parent afbc25e1b2
commit 14822c95e4

View File

@ -215,7 +215,8 @@ namespace RGB.NET.Devices.Corsair
for (int channel = 0; channel < channelsInfo.channelsCount; channel++)
{
CorsairLedId referenceLed = channel == 0 ? CorsairLedId.CustomDeviceChannel1Led1 : CorsairLedId.CustomDeviceChannel2Led1;
CorsairLedId referenceLed = GetChannelReferenceId(info.CorsairDeviceType, channel);
if (referenceLed == CorsairLedId.Invalid) continue;
_CorsairChannelInfo channelInfo = (_CorsairChannelInfo)Marshal.PtrToStructure(channelInfoPtr, typeof(_CorsairChannelInfo));
@ -247,6 +248,23 @@ namespace RGB.NET.Devices.Corsair
}
}
private static CorsairLedId GetChannelReferenceId(CorsairDeviceType deviceType, int channel)
{
if (deviceType == CorsairDeviceType.Cooler)
return CorsairLedId.CustomLiquidCoolerChannel1Led1;
else
{
switch (channel)
{
case 0: return CorsairLedId.CustomDeviceChannel1Led1;
case 1: return CorsairLedId.CustomDeviceChannel2Led1;
case 2: return CorsairLedId.CustomDeviceChannel3Led1;
}
}
return CorsairLedId.Invalid;
}
private void AddSpecialParts(ICorsairRGBDevice device)
{
if (device.DeviceInfo.Model.Equals("K95 RGB Platinum", StringComparison.OrdinalIgnoreCase))