diff --git a/RGB.NET.Core/Extensions/ColorExtensions.cs b/RGB.NET.Core/Extensions/ColorExtensions.cs
new file mode 100644
index 0000000..15d0c80
--- /dev/null
+++ b/RGB.NET.Core/Extensions/ColorExtensions.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace RGB.NET.Core
+{
+ public static class ColorExtensions
+ {
+ #region Methods
+
+ ///
+ /// Calculates the distance between the two given colors using the redmean algorithm.
+ /// For more infos check https://www.compuphase.com/cmetric.htm
+ ///
+ /// The start color of the distance calculation.
+ /// The end color fot the distance calculation.
+ ///
+ public static double DistanceTo(this Color color1, Color color2)
+ {
+ (_, byte r1, byte g1, byte b1) = color1.GetRGBBytes();
+ (_, byte r2, byte g2, byte b2) = color2.GetRGBBytes();
+
+ long rmean = (r1 + r2) / 2;
+ long r = r1 - r2;
+ long g = g1 - g2;
+ long b = b1 - b2;
+ return Math.Sqrt((((512 + rmean) * r * r) >> 8) + (4 * g * g) + (((767 - rmean) * b * b) >> 8));
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs
new file mode 100644
index 0000000..3cda1aa
--- /dev/null
+++ b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace RGB.NET.Devices.Novation.Attributes
+{
+ ///
+ ///
+ /// Specifies the led id mapping of a field.
+ ///
+ [AttributeUsage(AttributeTargets.Field)]
+ internal class LedIdMappingAttribute : Attribute
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets the led id mapping.
+ ///
+ internal LedIdMappings LedIdMapping { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The led id mapping.
+ internal LedIdMappingAttribute(LedIdMappings ledIdMapping)
+ {
+ this.LedIdMapping = ledIdMapping;
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Novation/Enum/NovationDevices.cs b/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
index c9cf763..f1afa2c 100644
--- a/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
+++ b/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
@@ -13,9 +13,17 @@ namespace RGB.NET.Devices.Novation
{
[DeviceId("Launchpad S")]
[ColorCapability(NovationColorCapabilities.LimitedRG)]
+ [LedIdMapping(LedIdMappings.Legacy)]
LaunchpadS,
+
[DeviceId("Launchpad Mini")]
[ColorCapability(NovationColorCapabilities.LimitedRG)]
- LaunchpadMini
+ [LedIdMapping(LedIdMappings.Legacy)]
+ LaunchpadMini,
+
+ [DeviceId("Launchpad MK2")]
+ [ColorCapability(NovationColorCapabilities.RGB)]
+ [LedIdMapping(LedIdMappings.Current)]
+ LaunchpadMK2
}
}
diff --git a/RGB.NET.Devices.Novation/Enum/NovationLedId.cs b/RGB.NET.Devices.Novation/Enum/NovationLedId.cs
deleted file mode 100644
index 22f44c3..0000000
--- a/RGB.NET.Devices.Novation/Enum/NovationLedId.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// ReSharper disable InconsistentNaming
-// ReSharper disable UnusedMember.Global
-
-#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
-
-namespace RGB.NET.Devices.Novation
-{
- ///
- /// Contains list of all LEDs available for all Novation devices.
- /// They are represented as Hex 0x[00][11] where [00] is the status flag, [1] the id of the led.
- ///
- //TODO DarthAffe 15.08.2017: Check if this is really correct for all devices
- public enum NovationLedId
- {
- Invalid = -1,
-
- Grid1 = 0x9000,
- Grid2 = 0x9001,
- Grid3 = 0x9002,
- Grid4 = 0x9003,
- Grid5 = 0x9004,
- Grid6 = 0x9005,
- Grid7 = 0x9006,
- Grid8 = 0x9007,
-
- Grid9 = 0x9010,
- Grid10 = 0x9011,
- Grid11 = 0x9012,
- Grid12 = 0x9013,
- Grid13 = 0x9014,
- Grid14 = 0x9015,
- Grid15 = 0x9016,
- Grid16 = 0x9017,
-
- Grid17 = 0x9020,
- Grid18 = 0x9021,
- Grid19 = 0x9022,
- Grid20 = 0x9023,
- Grid21 = 0x9024,
- Grid22 = 0x9025,
- Grid23 = 0x9026,
- Grid24 = 0x9027,
-
- Grid25 = 0x9030,
- Grid26 = 0x9031,
- Grid27 = 0x9032,
- Grid28 = 0x9033,
- Grid29 = 0x9034,
- Grid30 = 0x9035,
- Grid31 = 0x9036,
- Grid32 = 0x9037,
-
- Grid33 = 0x9040,
- Grid34 = 0x9041,
- Grid35 = 0x9042,
- Grid36 = 0x9043,
- Grid37 = 0x9044,
- Grid38 = 0x9045,
- Grid39 = 0x9046,
- Grid40 = 0x9047,
-
- Grid41 = 0x9050,
- Grid42 = 0x9051,
- Grid43 = 0x9052,
- Grid44 = 0x9053,
- Grid45 = 0x9054,
- Grid46 = 0x9055,
- Grid47 = 0x9056,
- Grid48 = 0x9057,
-
- Grid49 = 0x9060,
- Grid50 = 0x9061,
- Grid51 = 0x9062,
- Grid52 = 0x9063,
- Grid53 = 0x9064,
- Grid54 = 0x9065,
- Grid55 = 0x9066,
- Grid56 = 0x9067,
-
- Grid57 = 0x9070,
- Grid58 = 0x9071,
- Grid59 = 0x9072,
- Grid60 = 0x9073,
- Grid61 = 0x9074,
- Grid62 = 0x9075,
- Grid63 = 0x9076,
- Grid64 = 0x9077,
-
- Up = 0xB068,
- Down = 0xB069,
- Left = 0xB06A,
- Right = 0xB06B,
- Session = 0xB06C,
- User1 = 0xB06D,
- User2 = 0xB06E,
- Mix = 0xB06F,
-
- Scene1 = 0x9009,
- Scene2 = 0x9019,
- Scene3 = 0x9029,
- Scene4 = 0x9039,
- Scene5 = 0x9049,
- Scene6 = 0x9059,
- Scene7 = 0x9069,
- Scene8 = 0x9079
- }
-}
diff --git a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
index a3570c9..588e359 100644
--- a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
+++ b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
@@ -28,8 +28,8 @@ namespace RGB.NET.Devices.Novation
///
protected override ShortMessage CreateMessage(KeyValuePair