Skip to content

Commit b0acc61

Browse files
authored
Merge pull request #430 from DarthAffe/Development
2 parents 4e575e8 + 13f3dde commit b0acc61

18 files changed

+451
-137
lines changed

RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ private IEnumerable<ICorsairRGBDevice> LoadCorsairDevices()
273273
break;
274274

275275
case CorsairChannelDeviceType.EightLedSeriesFan:
276-
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "8-Led-Series Fan Fan"), updateQueue);
276+
string fanModelName = "8-Led-Series Fan";
277+
278+
if (device.model == "iCUE LINK System Hub")
279+
fanModelName = "RX Fan";
280+
281+
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, fanModelName), updateQueue);
277282
break;
278283

279284
case CorsairChannelDeviceType.DAP:
@@ -289,28 +294,33 @@ private IEnumerable<ICorsairRGBDevice> LoadCorsairDevices()
289294
break;
290295

291296
case CorsairChannelDeviceType.Strip:
292-
string modelName = "LED Strip";
297+
string stripModelName = "LED Strip";
293298

294299
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
295300
if ((device.model == "LS100 Starter Kit") && (ledCount == 138))
296-
modelName = "LS100 LED Strip (dual monitor)";
301+
stripModelName = "LS100 LED Strip (dual monitor)";
297302
else if ((device.model == "LS100 Starter Kit") && (ledCount == 84))
298-
modelName = "LS100 LED Strip (single monitor)";
303+
stripModelName = "LS100 LED Strip (single monitor)";
299304
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
300305
else if ((device.model == "LS100 Starter Kit") && (ledCount == 15))
301-
modelName = "LS100 LED Strip (short)";
306+
stripModelName = "LS100 LED Strip (short)";
302307
else if ((device.model == "LS100 Starter Kit") && (ledCount == 27))
303-
modelName = "LS100 LED Strip (long)";
308+
stripModelName = "LS100 LED Strip (long)";
304309

305-
yield return new CorsairLedStripRGBDevice(new CorsairLedStripRGBDeviceInfo(device, ledCount, offset, modelName), updateQueue);
310+
yield return new CorsairLedStripRGBDevice(new CorsairLedStripRGBDeviceInfo(device, ledCount, offset, stripModelName), updateQueue);
306311
break;
307312

308313
case CorsairChannelDeviceType.DRAM:
309314
yield return new CorsairMemoryRGBDevice(new CorsairMemoryRGBDeviceInfo(device, ledCount, offset, "DRAM"), updateQueue);
310315
break;
311316

312317
default:
313-
Throw(new RGBDeviceException("Unknown Device-Type"));
318+
319+
//Workaround to support LX Fans because they have an invalid ChannelDeviceType
320+
if ((device.model == "iCUE LINK System Hub") && (ledCount == 18))
321+
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "LX Fan"), updateQueue);
322+
else
323+
Throw(new RGBDeviceException("Unknown Device-Type"));
314324
break;
315325
}
316326

RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public static LogitechDeviceProvider Instance
7373
{ 0xC541, RGBDeviceType.Keyboard, "G915", LedMappings.PerKey, 0 },
7474
{ 0xC359, RGBDeviceType.Keyboard, "G915 X", LedMappings.PerKey, 0 },
7575
{ 0xC547, RGBDeviceType.Keyboard, "G915 X TKL", LedMappings.PerKey, 0 },
76+
{ 0xC358, RGBDeviceType.Keyboard, "G515", LedMappings.PerKey, 0 },
7677

7778
//non-rgb
7879
{ 0xC333, RGBDeviceType.Keyboard, "G610", LedMappings.PerKey, 0 },

RGB.NET.Devices.Razer/RazerDeviceProvider.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ public static RazerDeviceProvider Instance
151151
{ 0x02A0, RGBDeviceType.Keyboard, "Blade 18", LedMappings.Blade, RazerEndpointType.Keyboard },
152152
{ 0x02A1, RGBDeviceType.Keyboard, "Ornata V3", LedMappings.Keyboard, RazerEndpointType.Keyboard },
153153
{ 0x02A5, RGBDeviceType.Keyboard, "BlackWidow V4 75%", LedMappings.Keyboard, RazerEndpointType.Keyboard },
154+
{ 0x02A6, RGBDeviceType.Keyboard, "Huntsman V3 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard },
154155
{ 0x02A7, RGBDeviceType.Keyboard, "Huntsman V3 Pro TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard },
155156
{ 0x0A24, RGBDeviceType.Keyboard, "BlackWidow V3 TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard },
156157
{ 0x02BA, RGBDeviceType.Keyboard, "BlackWidow V4 Mini HyperSpeed", LedMappings.Keyboard, RazerEndpointType.Keyboard },
158+
{ 0x02B4, RGBDeviceType.Keyboard, "BlackWidow V4 Pro 75%", LedMappings.Keyboard, RazerEndpointType.Keyboard },
157159

158160
// Mice
159161
{ 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.Mouse, RazerEndpointType.Mouse },
@@ -255,6 +257,8 @@ public static RazerDeviceProvider Instance
255257
{ 0x0527, RGBDeviceType.Headset, "Kraken Ultimate", LedMappings.Headset, RazerEndpointType.Headset },
256258
{ 0x0560, RGBDeviceType.Headset, "Kraken Kitty V2", LedMappings.Headset, RazerEndpointType.Headset },
257259
{ 0x0F19, RGBDeviceType.Headset, "Kraken Kitty Edition", LedMappings.Headset, RazerEndpointType.Headset },
260+
{ 0X0533, RGBDeviceType.Headset, "Kraken V3 HyperSense", LedMappings.Headset, RazerEndpointType.Headset},
261+
{ 0X0574, RGBDeviceType.Headset, "Barracuda X Chroma", LedMappings.Headset, RazerEndpointType.Headset},
258262

259263
// Keypads
260264
{ 0x0111, RGBDeviceType.Keypad, "Nostromo", LedMappings.Keypad, RazerEndpointType.Keypad },

RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public static SteelSeriesDeviceProvider Instance
9696
//Mousepads
9797
{ 0x1507, RGBDeviceType.Mousepad, "QCK Prism", LedMappings.MousepadTwelveZone, SteelSeriesDeviceType.TwelveZone },
9898
{ 0x150D, RGBDeviceType.Mousepad, "QCK Prism Cloth", LedMappings.MousepadTwoZone, SteelSeriesDeviceType.TwoZone },
99+
{ 0x1516, RGBDeviceType.Mousepad, "QCK Prism Cloth 3XL", LedMappings.MousepadTwoZone, SteelSeriesDeviceType.TwoZone },
99100

100101
//Monitors
101102
{ 0x1126, RGBDeviceType.Monitor, "MGP27C", LedMappings.MonitorOnehundredandthreeZone, SteelSeriesDeviceType.OneHundredAndThreeZone },

RGB.NET.Devices.Wooting/Enum/WootingLayoutType.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ public enum WootingLayoutType
1515
{
1616
Unknown = -1,
1717
ANSI = 0,
18-
ISO = 1
19-
}
18+
ISO = 1,
19+
JIS = 2,
20+
ANSI_SPLIT_SPACEBAR = 3,
21+
ISO_SPLIT_SPACEBAR = 4,
22+
}

RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ namespace RGB.NET.Devices.Wooting.Generic;
1111
/// </summary>
1212
internal static class WootingLedMappings
1313
{
14+
15+
public const int ROWS = 6;
16+
public const int COLUMNS = 21;
17+
1418
#region Properties & Fields
1519

1620
private static readonly Dictionary<LedId, (int row, int column)> TKL = new()
@@ -126,7 +130,7 @@ internal static class WootingLedMappings
126130
{ LedId.Keyboard_F10, (0, 11) },
127131
{ LedId.Keyboard_F11, (0, 12) },
128132
{ LedId.Keyboard_F12, (0, 13) },
129-
{ LedId.Keyboard_Custom1, (0, 14) },
133+
{ LedId.Keyboard_Profile, (0, 14) },
130134
{ LedId.Keyboard_PrintScreen, (0, 15) },
131135
{ LedId.Keyboard_PauseBreak, (0, 16) },
132136

@@ -200,7 +204,11 @@ internal static class WootingLedMappings
200204
{ LedId.Keyboard_LeftGui, (5, 1) },
201205
{ LedId.Keyboard_LeftAlt, (5, 2) },
202206
{ LedId.Keyboard_International3, (5, 3) },//JIS key
207+
{ LedId.Keyboard_Custom1, (5, 4) },
208+
{ LedId.Keyboard_Custom2, (5, 5) },
203209
{ LedId.Keyboard_Space, (5, 6) },
210+
{ LedId.Keyboard_Custom3, (5, 7) },
211+
{ LedId.Keyboard_Custom4, (5, 8) },
204212
{ LedId.Keyboard_International4, (5, 9) },//JIS key
205213
{ LedId.Keyboard_RightAlt, (5, 10) },
206214
{ LedId.Keyboard_RightGui, (5, 11) },
Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
1-
using RGB.NET.Core;
2-
using RGB.NET.Devices.Wooting.Native;
1+
using System.Collections.Generic;
2+
using RGB.NET.Core;
3+
using RGB.NET.Devices.Wooting.Enum;
34

45
namespace RGB.NET.Devices.Wooting.Generic;
56

6-
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
7-
/// <inheritdoc cref="IWootingRGBDevice" />
8-
/// <summary>
9-
/// Represents a Wooting-device
10-
/// </summary>
117
public abstract class WootingRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IWootingRGBDevice
128
where TDeviceInfo : WootingRGBDeviceInfo
139
{
10+
#region Properties & Fields
11+
12+
private readonly Dictionary<LedId, (int row, int column)> _mapping;
13+
14+
#endregion
15+
1416
#region Constructors
1517

16-
/// <summary>
17-
/// Initializes a new instance of the <see cref="WootingRGBDevice{TDeviceInfo}"/> class.
18-
/// </summary>
19-
/// <param name="info">The generic information provided by Wooting for the device.</param>
20-
/// <param name="updateQueue">The update queue used to update this device.</param>
21-
protected WootingRGBDevice(TDeviceInfo info, IUpdateQueue updateQueue)
18+
internal WootingRGBDevice(WootingDeviceType deviceType, TDeviceInfo info, IUpdateQueue updateQueue)
2219
: base(info, updateQueue)
2320
{
21+
_mapping = WootingLedMappings.Mapping[deviceType];
22+
InitializeLayout();
2423
}
2524

2625
#endregion
2726

28-
2927
#region Methods
3028

29+
private void InitializeLayout()
30+
{
31+
foreach (KeyValuePair<LedId, (int row, int column)> led in _mapping)
32+
AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19));
33+
}
34+
35+
/// <inheritdoc />
36+
protected override object GetLedCustomData(LedId ledId) => _mapping[ledId];
37+
38+
/// <inheritdoc />
3139
public override void Dispose()
3240
{
33-
_WootingSDK.SelectDevice(DeviceInfo.WootingDeviceIndex);
34-
_WootingSDK.Reset();
41+
UpdateQueue.Dispose();
3542

3643
base.Dispose();
3744
}
38-
45+
3946
#endregion
40-
}
47+
}
Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
using RGB.NET.Core;
2-
using RGB.NET.Devices.Wooting.Enum;
3-
using RGB.NET.Devices.Wooting.Native;
42

53
namespace RGB.NET.Devices.Wooting.Generic;
64

7-
/// <inheritdoc />
8-
/// <summary>
9-
/// Represents a generic information for a Wooting-<see cref="T:RGB.NET.Core.IRGBDevice" />.
10-
/// </summary>
11-
public class WootingRGBDeviceInfo : IRGBDeviceInfo
5+
public abstract class WootingRGBDeviceInfo : IRGBDeviceInfo
126
{
137
#region Properties & Fields
148

@@ -27,37 +21,16 @@ public class WootingRGBDeviceInfo : IRGBDeviceInfo
2721
/// <inheritdoc />
2822
public object? LayoutMetadata { get; set; }
2923

30-
/// <summary>
31-
/// Gets the <see cref="Enum.WootingDeviceType"/> of the <see cref="WootingRGBDevice{TDeviceInfo}"/>.
32-
/// </summary>
33-
public WootingDeviceType WootingDeviceType { get; }
34-
35-
/// <summary>
36-
/// Gets the <see cref="Enum.WootingLayoutType"/> of the <see cref="WootingRGBDevice{TDeviceInfo}"/>.
37-
/// </summary>
38-
public WootingLayoutType WootingLayoutType { get; }
39-
40-
public byte WootingDeviceIndex { get; }
41-
4224
#endregion
4325

4426
#region Constructors
4527

46-
/// <summary>
47-
/// Internal constructor of managed <see cref="WootingRGBDeviceInfo"/>.
48-
/// </summary>
49-
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
50-
/// <param name="deviceInfo">The <see cref="_WootingDeviceInfo"/> of the <see cref="IRGBDevice"/>.</param>
51-
internal WootingRGBDeviceInfo(RGBDeviceType deviceType, _WootingDeviceInfo deviceInfo, byte deviceIndex)
28+
protected WootingRGBDeviceInfo(RGBDeviceType deviceType, string model, string name)
5229
{
5330
this.DeviceType = deviceType;
54-
this.WootingDeviceType = deviceInfo.DeviceType;
55-
this.WootingLayoutType = deviceInfo.LayoutType;
56-
this.WootingDeviceIndex = deviceIndex;
57-
58-
Model = deviceInfo.Model;
59-
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
31+
this.Model = model;
32+
this.DeviceName = name;
6033
}
6134

6235
#endregion
63-
}
36+
}

0 commit comments

Comments
 (0)