mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Merge pull request #111 from DarthAffe/SDK/Corsair
Added LS100 strips support, detecting any iCUE configuration
This commit is contained in:
commit
6b5515aeb2
@ -227,7 +227,7 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
{
|
{
|
||||||
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo));
|
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo));
|
||||||
|
|
||||||
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info.CorsairDeviceIndex, nativeDeviceInfo, channelDeviceInfo, referenceLed, modelCounter));
|
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info, nativeDeviceInfo, channelDeviceInfo, referenceLed, modelCounter));
|
||||||
referenceLed += channelDeviceInfo.deviceLedCount;
|
referenceLed += channelDeviceInfo.deviceLedCount;
|
||||||
|
|
||||||
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
||||||
|
|||||||
@ -28,15 +28,16 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDeviceInfo" />.
|
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDeviceInfo" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDevice" />.</param>
|
/// <param name="info">The info describing the the <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDevice" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
||||||
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
||||||
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
|
internal CorsairCustomRGBDeviceInfo(CorsairRGBDeviceInfo info, _CorsairDeviceInfo nativeInfo,
|
||||||
|
_CorsairChannelDeviceInfo channelDeviceInfo,
|
||||||
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
|
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
|
||||||
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
|
: base(info.CorsairDeviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
|
||||||
GetModelName(channelDeviceInfo.type), modelCounter)
|
GetModelName(info, channelDeviceInfo), modelCounter)
|
||||||
{
|
{
|
||||||
this.ReferenceCorsairLed = referenceCorsairLed;
|
this.ReferenceCorsairLed = referenceCorsairLed;
|
||||||
|
|
||||||
@ -72,9 +73,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetModelName(CorsairChannelDeviceType deviceType)
|
private static string GetModelName(IRGBDeviceInfo info, _CorsairChannelDeviceInfo channelDeviceInfo)
|
||||||
{
|
{
|
||||||
switch (deviceType)
|
switch (channelDeviceInfo.type)
|
||||||
{
|
{
|
||||||
case CorsairChannelDeviceType.Invalid:
|
case CorsairChannelDeviceType.Invalid:
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
@ -92,7 +93,19 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
return "ML Fan";
|
return "ML Fan";
|
||||||
|
|
||||||
case CorsairChannelDeviceType.Strip:
|
case CorsairChannelDeviceType.Strip:
|
||||||
return "Led Strip";
|
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
|
||||||
|
if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138))
|
||||||
|
return "LS100 Led Strip (dual monitor)";
|
||||||
|
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
|
||||||
|
return "LS100 Led Strip (single monitor)";
|
||||||
|
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
|
||||||
|
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
|
||||||
|
return "LS100 Led Strip (short)";
|
||||||
|
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
|
||||||
|
return "LS100 Led Strip (long)";
|
||||||
|
// Device model is "Commander Pro" for regular LED strips
|
||||||
|
else
|
||||||
|
return "Led Strip";
|
||||||
|
|
||||||
case CorsairChannelDeviceType.DAP:
|
case CorsairChannelDeviceType.DAP:
|
||||||
return "DAP Fan";
|
return "DAP Fan";
|
||||||
@ -101,7 +114,7 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
return "Pump";
|
return "Pump";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
|
throw new ArgumentOutOfRangeException(nameof(channelDeviceInfo.type), channelDeviceInfo.type, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace RGB.NET.Devices.Wooting.Generic
|
|||||||
|
|
||||||
_WootingSDK.ArrayUpdateKeyboard();
|
_WootingSDK.ArrayUpdateKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,18 +4,18 @@ using RGB.NET.Devices.Wooting.Enum;
|
|||||||
namespace RGB.NET.Devices.Wooting.Native
|
namespace RGB.NET.Devices.Wooting.Native
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct _WootingDeviceInfo
|
internal struct _WootingDeviceInfo
|
||||||
{
|
{
|
||||||
public bool Connected { get; private set; }
|
internal bool Connected { get; private set; }
|
||||||
|
|
||||||
public string Model { get; private set; }
|
internal string Model { get; private set; }
|
||||||
|
|
||||||
public byte MaxRows { get; private set; }
|
internal byte MaxRows { get; private set; }
|
||||||
|
|
||||||
public byte MaxColumns { get; private set; }
|
internal byte MaxColumns { get; private set; }
|
||||||
|
|
||||||
public byte KeycodeLimit { get; private set; }
|
internal byte KeycodeLimit { get; private set; }
|
||||||
|
|
||||||
public WootingDeviceType DeviceType { get; private set; }
|
internal WootingDeviceType DeviceType { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,13 +6,12 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.Wooting.Native
|
namespace RGB.NET.Devices.Wooting.Native
|
||||||
{
|
{
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public class _WootingSDK
|
internal static class _WootingSDK
|
||||||
{
|
{
|
||||||
#region Library management
|
#region Library management
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user