mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
ASUS - Added mechanism to add extra LEDs via lights
This commit is contained in:
parent
e86003f1ea
commit
d6054cf527
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using AuraServiceLib;
|
using AuraServiceLib;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
@ -44,8 +43,8 @@ namespace RGB.NET.Devices.Asus
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
int unknownLed = (int)LedId.Unknown1;
|
int unknownLed = (int)LedId.Unknown1;
|
||||||
|
|
||||||
List<IAuraRgbKey> keys = ((IAuraSyncKeyboard)DeviceInfo.Device).Keys.Cast<IAuraRgbKey>().ToList();
|
ClearTags();
|
||||||
foreach (IAuraRgbKey key in keys)
|
foreach (IAuraRgbKey key in ((IAuraSyncKeyboard)DeviceInfo.Device).Keys)
|
||||||
{
|
{
|
||||||
if (AsusKeyboardLedMapping.MAPPING.TryGetValue((AsusLedId)key.Code, out LedId ledId))
|
if (AsusKeyboardLedMapping.MAPPING.TryGetValue((AsusLedId)key.Code, out LedId ledId))
|
||||||
AddAsusLed((AsusLedId)key.Code, ledId, new Point(pos++ * 19, 0), new Size(19, 19));
|
AddAsusLed((AsusLedId)key.Code, ledId, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||||
@ -54,17 +53,20 @@ namespace RGB.NET.Devices.Asus
|
|||||||
AddAsusLed((AsusLedId)key.Code, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
AddAsusLed((AsusLedId)key.Code, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||||
unknownLed++;
|
unknownLed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TagAsusLed(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < ((IAuraSyncKeyboard)DeviceInfo.Device).Lights.Count; index++)
|
for (int index = 0; index < ((IAuraSyncKeyboard)DeviceInfo.Device).Lights.Count; index++)
|
||||||
{
|
{
|
||||||
IAuraRgbLight light = ((IAuraSyncKeyboard)DeviceInfo.Device).Lights[index];
|
IAuraRgbLight light = ((IAuraSyncKeyboard)DeviceInfo.Device).Lights[index];
|
||||||
if (keys.Contains(light))
|
if (IsAsusLedTagged(light))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddAsusLed(index, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
AddAsusLed(index, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||||
unknownLed++;
|
unknownLed++;
|
||||||
}
|
}
|
||||||
|
ClearTags();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -100,6 +102,22 @@ namespace RGB.NET.Devices.Asus
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClearTags()
|
||||||
|
{
|
||||||
|
foreach (IAuraRgbLight light in ((IAuraSyncKeyboard)DeviceInfo.Device).Lights)
|
||||||
|
light.Color = 0x000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TagAsusLed(IAuraRgbKey key)
|
||||||
|
{
|
||||||
|
key.Color = 0x000001;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsAsusLedTagged(IAuraRgbLight light)
|
||||||
|
{
|
||||||
|
return light.Color == 0x000001;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user