mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Add support for LGS 9
This commit is contained in:
1 parent
e121c16e45
commit
cd96851fdf
6 files changed
+30
-148
No files matched your search
@@ -311,7 +311,6 @@
|
|||||||
<Compile Include="DeviceProviders\Corsair\CorsairKeyboard.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairKeyboard.cs" />
|
||||||
<Compile Include="DeviceProviders\KeyboardProvider.cs" />
|
<Compile Include="DeviceProviders\KeyboardProvider.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\G910.cs" />
|
<Compile Include="DeviceProviders\Logitech\G910.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\KeyboardNames.cs" />
|
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\KeyMap.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\KeyMap.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\LogitechGSDK.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\LogitechGSDK.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\OrionUtilities.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\OrionUtilities.cs" />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Artemis.DAL;
|
|||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
|
using LedCSharp;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Logitech
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
{
|
{
|
||||||
@@ -54,17 +55,17 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Color G-logo, lets also try some other values to see what happens
|
// Color G-logo, lets also try some other values to see what happens
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_LOGO, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_BADGE, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_BADGE, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_1, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_1, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_2, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_2, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_3, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_3, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_4, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_4, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_5, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_5, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_6, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_6, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_7, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_7, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_8, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_8, 0, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_9, 0, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_9, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Artemis.DAL;
|
|||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
|
using LedCSharp;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Logitech
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
{
|
{
|
||||||
@@ -75,21 +76,21 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Color the extra keys on the left side of the keyboard
|
// Color the extra keys on the left side of the keyboard
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 1);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_LOGO, 0, 1);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_1, 0, 2);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_1, 0, 2);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_2, 0, 3);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_2, 0, 3);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_3, 0, 4);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_3, 0, 4);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_4, 0, 5);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_4, 0, 5);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_5, 0, 6);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_5, 0, 6);
|
||||||
|
|
||||||
// Color the extra keys on the top of the keyboard
|
// Color the extra keys on the top of the keyboard
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_6, 3, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_6, 3, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_7, 4, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_7, 4, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_8, 5, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_8, 5, 0);
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_9, 6, 0);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_9, 6, 0);
|
||||||
|
|
||||||
// Color the G-badge
|
// Color the G-badge
|
||||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_BADGE, 5, 6);
|
SetLogitechColorFromCoordinates(resized, keyboardNames.G_BADGE, 5, 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
|
||||||
using Artemis.Utilities.DataReaders;
|
using Artemis.Utilities.DataReaders;
|
||||||
using Microsoft.Win32;
|
using LedCSharp;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Logitech
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
{
|
{
|
||||||
@@ -20,15 +19,13 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
|
LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
|
||||||
LogitechGSDK.LogiLedShutdown();
|
LogitechGSDK.LogiLedShutdown();
|
||||||
|
|
||||||
// Turn it into one long number...
|
|
||||||
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
|
||||||
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
||||||
"Please check your cables and updating the Logitech Gaming Software\n" +
|
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||||
$"A minimum version of 8.81.15 is required (detected {majorNum}.{minorNum}.{buildNum}).\n\n" +
|
$"A minimum version of 8.81.15 is required (detected {majorNum}.{minorNum}.{buildNum}).\n\n" +
|
||||||
"If the detected version differs from the version LGS is reporting, reinstall LGS or see the FAQ.\n\n" +
|
"If the detected version differs from the version LGS is reporting, reinstall LGS or see the FAQ.\n\n" +
|
||||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
|
|
||||||
return version >= 88115;
|
return majorNum >= 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
@@ -48,12 +45,12 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
LogitechGSDK.LogiLedShutdown();
|
LogitechGSDK.LogiLedShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetLogitechColorFromCoordinates(Bitmap bitmap, KeyboardNames key, int x, int y)
|
protected void SetLogitechColorFromCoordinates(Bitmap bitmap, keyboardNames key, int x, int y)
|
||||||
{
|
{
|
||||||
var color = bitmap.GetPixel(x, y);
|
var color = bitmap.GetPixel(x, y);
|
||||||
var rPer = (int)Math.Round(color.R / 2.55);
|
var rPer = (int) Math.Round(color.R / 2.55);
|
||||||
var gPer = (int)Math.Round(color.G / 2.55);
|
var gPer = (int) Math.Round(color.G / 2.55);
|
||||||
var bPer = (int)Math.Round(color.B / 2.55);
|
var bPer = (int) Math.Round(color.B / 2.55);
|
||||||
|
|
||||||
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, rPer, gPer, bPer);
|
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, rPer, gPer, bPer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Logitech.Utilities
|
|
||||||
{
|
|
||||||
public class LogitechGSDK
|
|
||||||
{
|
|
||||||
//LED SDK
|
|
||||||
private const int LOGI_DEVICETYPE_MONOCHROME_ORD = 0;
|
|
||||||
private const int LOGI_DEVICETYPE_RGB_ORD = 1;
|
|
||||||
private const int LOGI_DEVICETYPE_PERKEY_RGB_ORD = 2;
|
|
||||||
|
|
||||||
public const int LOGI_DEVICETYPE_MONOCHROME = 1 << LOGI_DEVICETYPE_MONOCHROME_ORD;
|
|
||||||
public const int LOGI_DEVICETYPE_RGB = 1 << LOGI_DEVICETYPE_RGB_ORD;
|
|
||||||
public const int LOGI_DEVICETYPE_PERKEY_RGB = 1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD;
|
|
||||||
public const int LOGI_LED_BITMAP_WIDTH = 21;
|
|
||||||
public const int LOGI_LED_BITMAP_HEIGHT = 6;
|
|
||||||
public const int LOGI_LED_BITMAP_BYTES_PER_KEY = 4;
|
|
||||||
|
|
||||||
public const int LOGI_LED_BITMAP_SIZE =
|
|
||||||
LOGI_LED_BITMAP_WIDTH*LOGI_LED_BITMAP_HEIGHT*LOGI_LED_BITMAP_BYTES_PER_KEY;
|
|
||||||
|
|
||||||
public const int LOGI_LED_DURATION_INFINITE = 0;
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedInit();
|
|
||||||
|
|
||||||
//Config option functions
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedGetConfigOptionNumber([MarshalAs(UnmanagedType.LPWStr)] string configPath,
|
|
||||||
ref double defaultNumber);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedGetConfigOptionBool([MarshalAs(UnmanagedType.LPWStr)] string configPath,
|
|
||||||
ref bool defaultRed);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedGetConfigOptionColor([MarshalAs(UnmanagedType.LPWStr)] string configPath,
|
|
||||||
ref int defaultRed, ref int defaultGreen, ref int defaultBlue);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedGetConfigOptionKeyInput([MarshalAs(UnmanagedType.LPWStr)] string configPath,
|
|
||||||
StringBuilder buffer, int bufsize);
|
|
||||||
|
|
||||||
/////////////////////
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetTargetDevice(int targetDevice);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedGetSdkVersion(ref int majorNum, ref int minorNum, ref int buildNum);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSaveCurrentLighting();
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedRestoreLighting();
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedFlashLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
|
||||||
int milliSecondsDuration, int milliSecondsInterval);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedPulseLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
|
||||||
int milliSecondsDuration, int milliSecondsInterval);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedStopEffects();
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedExcludeKeysFromBitmap(KeyboardNames[] keyList, int listCount);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLightingFromBitmap(byte[] bitmap);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLightingForKeyWithScanCode(int keyCode, int redPercentage,
|
|
||||||
int greenPercentage, int bluePercentage);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLightingForKeyWithHidCode(int keyCode, int redPercentage,
|
|
||||||
int greenPercentage, int bluePercentage);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLightingForKeyWithQuartzCode(int keyCode, int redPercentage,
|
|
||||||
int greenPercentage, int bluePercentage);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSetLightingForKeyWithKeyName(KeyboardNames keyCode, int redPercentage,
|
|
||||||
int greenPercentage, int bluePercentage);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedSaveLightingForKey(KeyboardNames keyName);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedRestoreLightingForKey(KeyboardNames keyName);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedFlashSingleKey(KeyboardNames keyName, int redPercentage, int greenPercentage,
|
|
||||||
int bluePercentage, int msDuration, int msInterval);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedPulseSingleKey(KeyboardNames keyName, int startRedPercentage,
|
|
||||||
int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage,
|
|
||||||
int finishBluePercentage, int msDuration, bool isInfinite);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool LogiLedStopEffectsOnKey(KeyboardNames keyName);
|
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void LogiLedShutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Reference in new issue
Block a user