1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Added logitech Pro and G Pro

This commit is contained in:
Darth Affe 2018-03-29 20:55:07 +02:00
parent c8a02b5f90
commit 9be34c1bab
5 changed files with 212 additions and 11 deletions

View File

@ -19,6 +19,7 @@ namespace RGB.NET.Devices.Logitech.HID
("G910", RGBDeviceType.Keyboard, 0xC32B, "DE", @"Keyboards\G910\UK"), //TODO DarthAffe 15.11.2017: Somehow detect the current layout
("G810", RGBDeviceType.Keyboard, 0xC337, "DE", @"Keyboards\G810\UK"),
("G610", RGBDeviceType.Keyboard, 0xC333, "DE", @"Keyboards\G610\UK"),
("Pro", RGBDeviceType.Keyboard, 0xC339, "DE", @"Keyboards\Pro\UK"),
};
private static readonly List<(string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath)> PER_DEVICE_DEVICES
@ -27,6 +28,7 @@ namespace RGB.NET.Devices.Logitech.HID
("G903", RGBDeviceType.Mouse, 0xC086, "default", @"Mice\G903"),
("G403", RGBDeviceType.Mouse, 0xC083, "default", @"Mice\G403"),
("G502", RGBDeviceType.Mouse, 0xC332, "default", @"Mice\G502"),
("G Pro", RGBDeviceType.Mouse, 0xC085, "default", @"Mice\GPro"),
};
#endregion

View File

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Logitech Pro Gaming Keyboard - Physical UK</Name>
<Description>Physical UK-Layout of Logitech Pro Gaming Keyboard (Logical: ???)</Description>
<Author>Darth Affe</Author>
<Type>Keyboard</Type>
<Lighting>Key</Lighting>
<Vendor>Logitech</Vendor>
<Model>Pro</Model>
<Width>360</Width> <!-- Not exact! -->
<Height>152</Height>
<ImageBasePath>Images\Logitech\Keyboards</ImageBasePath>
<DeviceImage></DeviceImage>
<Leds>
<!-- Esc -> Pause -->
<Led Id="Keyboard_Escape">
<X>5</X>
<Y>28</Y>
</Led>
<Led Id="Keyboard_F1">
<X>+12.667</X>
</Led>
<Led Id="Keyboard_F2" />
<Led Id="Keyboard_F3" />
<Led Id="Keyboard_F4" />
<Led Id="Keyboard_F5">
<X>+12.667</X>
</Led>
<Led Id="Keyboard_F6" />
<Led Id="Keyboard_F7" />
<Led Id="Keyboard_F8" />
<Led Id="Keyboard_F9">
<X>+12.667</X>
</Led>
<Led Id="Keyboard_F10" />
<Led Id="Keyboard_F11" />
<Led Id="Keyboard_F12" />
<Led Id="Keyboard_PrintScreen">
<X>+6.75</X>
</Led>
<Led Id="Keyboard_ScrollLock" />
<Led Id="Keyboard_PauseBreak" />
<!-- ^ -> PageUp -->
<Led Id="Keyboard_GraveAccentAndTilde">
<X>5</X>
<Y>52</Y>
</Led>
<Led Id="Keyboard_1" />
<Led Id="Keyboard_2" />
<Led Id="Keyboard_3" />
<Led Id="Keyboard_4" />
<Led Id="Keyboard_5" />
<Led Id="Keyboard_6" />
<Led Id="Keyboard_7" />
<Led Id="Keyboard_8" />
<Led Id="Keyboard_9" />
<Led Id="Keyboard_0" />
<Led Id="Keyboard_MinusAndUnderscore" />
<Led Id="Keyboard_EqualsAndPlus" />
<Led Id="Keyboard_Backspace">
<Width>2</Width>
</Led>
<Led Id="Keyboard_Insert">
<X>+6.75</X>
</Led>
<Led Id="Keyboard_Home" />
<Led Id="Keyboard_PageUp" />
<!-- Tab -> PageDown -->
<Led Id="Keyboard_Tab">
<X>5</X>
<Y>+</Y>
<Width>1.5</Width>
</Led>
<Led Id="Keyboard_Q" />
<Led Id="Keyboard_W" />
<Led Id="Keyboard_E" />
<Led Id="Keyboard_R" />
<Led Id="Keyboard_T" />
<Led Id="Keyboard_Y" />
<Led Id="Keyboard_U" />
<Led Id="Keyboard_I" />
<Led Id="Keyboard_O" />
<Led Id="Keyboard_P" />
<Led Id="Keyboard_BracketLeft" />
<Led Id="Keyboard_BracketRight" />
<Led Id="Keyboard_Enter">
<Shape>M0,0 L0,0.5 L0.16666666666,0.5 L0.16666666666,1 L1,1 L1,0 Z</Shape>
<Width>1.5</Width>
<Height>2</Height>
</Led>
<Led Id="Keyboard_Delete">
<X>+6.75</X>
</Led>
<Led Id="Keyboard_End" />
<Led Id="Keyboard_PageDown" />
<!-- CapsLock -> NonUsTilde -->
<Led Id="Keyboard_CapsLock">
<X>5</X>
<Y>+</Y>
<Width>1.75</Width>
</Led>
<Led Id="Keyboard_A" />
<Led Id="Keyboard_S" />
<Led Id="Keyboard_D" />
<Led Id="Keyboard_F" />
<Led Id="Keyboard_G" />
<Led Id="Keyboard_H" />
<Led Id="Keyboard_J" />
<Led Id="Keyboard_K" />
<Led Id="Keyboard_L" />
<Led Id="Keyboard_SemicolonAndColon" />
<Led Id="Keyboard_ApostropheAndDoubleQuote" />
<Led Id="Keyboard_NonUsTilde" />
<!-- LShift -> ArrowUp -->
<Led Id="Keyboard_LeftShift">
<X>5</X>
<Y>+</Y>
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_Backslash" />
<Led Id="Keyboard_Z" />
<Led Id="Keyboard_X" />
<Led Id="Keyboard_C" />
<Led Id="Keyboard_V" />
<Led Id="Keyboard_B" />
<Led Id="Keyboard_N" />
<Led Id="Keyboard_M" />
<Led Id="Keyboard_CommaAndLessThan" />
<Led Id="Keyboard_PeriodAndBiggerThan" />
<Led Id="Keyboard_SlashAndQuestionMark" />
<Led Id="Keyboard_RightShift">
<Width>2.75</Width>
</Led>
<Led Id="Keyboard_ArrowUp">
<X>+25.75</X>
</Led>
<!-- LCtrl -> ArrowRight -->
<Led Id="Keyboard_LeftCtrl">
<X>5</X>
<Y>+</Y>
<Width>1.5</Width>
</Led>
<Led Id="Keyboard_LeftGui">
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_LeftAlt">
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_Space">
<Width>5.75</Width>
</Led>
<Led Id="Keyboard_RightAlt">
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_RightGui">
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_Application">
<Width>1.25</Width>
</Led>
<Led Id="Keyboard_RightCtrl">
<Width>1.5</Width>
</Led>
<Led Id="Keyboard_ArrowLeft">
<X>+6.75</X>
</Led>
<Led Id="Keyboard_ArrowDown" />
<Led Id="Keyboard_ArrowRight" />
<Led Id="Logo">
<Shape>M 0.43535,0.91509 c -0.083,-0.013 -0.1809,-0.0541 -0.24123,-0.11683 -0.21672,-0.2247 -0.10831,-0.63995 0.19645,-0.71442 0.044,-0.0108 0.44173,-0.0156 0.47505,-0.006 0.0632,0.0184 0.0708,0.15184 0.0119,0.18175 -0.0174,0.009 -0.0369,0.009 -0.21797,0.009 -0.23755,0 -0.25559,-0.002 -0.3144,0.067 -0.14073,0.16404 -0.0357,0.36697 0.16357,0.40076 0.0569,0.01 0.0835,0.0391 0.0831,0.0846 -4.5e-4,0.0636 -0.0621,0.10873 -0.15647,0.0941 z m 0.36491,6.7e-4 c -0.0366,-0.0138 -0.0539,-0.0325 -0.0567,-0.0973 -0.006,-0.14226 -0.0741,-0.23758 -0.21563,-0.24355 -0.0562,-0.003 -0.0629,-0.004 -0.0811,-0.0233 -0.0344,-0.0359 -0.021,-0.11984 0.0238,-0.14402 0.0129,-0.007 0.0145,-0.007 0.19631,-0.007 0.25897,0 0.25297,0.005 0.25151,0.27271 -8e-4,0.17441 -8e-4,0.19394 -0.0107,0.20972 -0.0183,0.0297 -0.0769,0.0443 -0.10753,0.0326 Z</Shape>
<X>5</X>
<Y>5</Y>
</Led>
</Leds>
</Device>

View File

@ -156,7 +156,7 @@ namespace RGB.NET.Devices.Logitech
internal static byte[] CreateBitmap() => new byte[BITMAP_SIZE];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void SetColor(ref byte[] bitmap, int offset, Color color)
internal static void SetColor(byte[] bitmap, int offset, Color color)
{
bitmap[offset] = color.B;
bitmap[offset + 1] = color.G;

View File

@ -7,11 +7,19 @@ namespace RGB.NET.Devices.Logitech
{
public class LogitechPerKeyUpdateQueue : UpdateQueue
{
#region Properties & Fields
private readonly byte[] _bitmap;
#endregion
#region Constructors
public LogitechPerKeyUpdateQueue(IUpdateTrigger updateTrigger)
: base(updateTrigger)
{ }
{
_bitmap = BitmapMapping.CreateBitmap();
}
#endregion
@ -22,28 +30,27 @@ namespace RGB.NET.Devices.Logitech
{
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.PerKeyRGB);
byte[] bitmap = null;
Array.Clear(_bitmap, 0, _bitmap.Length);
bool usesBitmap = false;
foreach (KeyValuePair<object, Color> data in dataSet)
{
(LedId id, int customData) = ((LedId, int))data.Key;
(LedId id, LogitechLedId customData) = ((LedId, LogitechLedId))data.Key;
// DarthAffe 26.03.2017: This is only needed since update by name doesn't work as expected for all keys ...
if (BitmapMapping.BitmapOffset.TryGetValue(id, out int bitmapOffset))
{
if (bitmap == null)
bitmap = BitmapMapping.CreateBitmap();
BitmapMapping.SetColor(ref bitmap, bitmapOffset, data.Value);
BitmapMapping.SetColor(_bitmap, bitmapOffset, data.Value);
usesBitmap = true;
}
else
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(customData,
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName((int)customData,
(int)Math.Round(data.Value.RPercent * 100),
(int)Math.Round(data.Value.GPercent * 100),
(int)Math.Round(data.Value.BPercent * 100));
}
if (bitmap != null)
_LogitechGSDK.LogiLedSetLightingFromBitmap(bitmap);
if (usesBitmap)
_LogitechGSDK.LogiLedSetLightingFromBitmap(_bitmap);
}
#endregion

View File

@ -202,6 +202,9 @@
<Content Include="Layouts\Logitech\Keyboards\G610\UK.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Layouts\Logitech\Keyboards\Pro\UK.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Layouts\Logitech\Keyboards\G910\UK.xml">
<SubType>Designer</SubType>
</Content>