Implemented update queue and corrected the LED mappings

This commit is contained in:
SpoinkyNL committed 2019-12-13 10:01:05 +01:00
1 parent 7690a49e43
commit a94509dfcb
8 files changed
+96 -26

No files matched your search

@@ -7,6 +7,6 @@ namespace RGB.NET.Devices.Wooting.Generic
/// </summary>
internal interface IWootingRGBDevice : IRGBDevice
{
void Initialize(UpdateQueue updateQueue);
void Initialize(IDeviceUpdateTrigger updateTrigger);
}
}
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using RGB.NET.Core;
using RGB.NET.Devices.Wooting.Native;
namespace RGB.NET.Devices.Wooting.Generic
{
@@ -44,11 +41,11 @@ namespace RGB.NET.Devices.Wooting.Generic
#endregion
#region Methods
/// <summary>
/// Initializes the device.
/// </summary>
public void Initialize(UpdateQueue updateQueue)
public void Initialize(IDeviceUpdateTrigger updateTrigger)
{
InitializeLayout();
@@ -58,7 +55,7 @@ namespace RGB.NET.Devices.Wooting.Generic
Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
}
UpdateQueue = updateQueue;
UpdateQueue = new WootingUpdateQueue(updateTrigger);
}
/// <summary>
@@ -0,0 +1,42 @@
using System.Collections.Generic;
using RGB.NET.Core;
using RGB.NET.Devices.Wooting.Native;
namespace RGB.NET.Devices.Wooting.Generic
{
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for cooler master devices.
/// </summary>
public class WootingUpdateQueue : UpdateQueue
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="WootingUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
public WootingUpdateQueue(IDeviceUpdateTrigger updateTrigger)
: base(updateTrigger)
{
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(Dictionary<object, Color> dataSet)
{
foreach (KeyValuePair<object, Color> data in dataSet)
{
(int row, int column) = ((int, int))data.Key;
_WootingSDK.ArraySetSingle((byte)row, (byte)column, data.Value.GetR(), data.Value.GetG(), data.Value.GetB());
}
_WootingSDK.ArrayUpdateKeyboard();
}
#endregion
}
}