Added map for Strix 4-Zone RGB (#1619)

* ....

* Strix 4 Zone RGB
This commit is contained in:
DLdota
2023-11-20 10:00:22 +02:00
committed by GitHub
parent fad7396c8f
commit bf1ffddf15
2 changed files with 53 additions and 23 deletions

View File

@@ -355,7 +355,7 @@ public static class AppConfig
public static bool IsStrixLimitedRGB() public static bool IsStrixLimitedRGB()
{ {
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513RS") || ContainsModel("G513RM"); return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513RS") || ContainsModel("G513RM") || ContainsModel("G713PV");
} }
public static bool IsZ13() public static bool IsZ13()

View File

@@ -78,6 +78,7 @@ namespace GHelper.USB
static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivobook(); static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivobook();
static bool isStrix = AppConfig.IsStrix(); static bool isStrix = AppConfig.IsStrix();
static bool isStrix4Zone = AppConfig.IsStrixLimitedRGB();
static public bool isSingleColor = false; static public bool isSingleColor = false;
@@ -425,6 +426,16 @@ namespace GHelper.USB
/*90 ARMC LB1 LB2 LB3 LB4 LB5 LB6 LOGO LIDL LIDR */ /*90 ARMC LB1 LB2 LB3 LB4 LB5 LB6 LOGO LIDL LIDR */
2, 4, 4, 5, 6, 7, 7, 0, 0, 3, 2, 4, 4, 5, 6, 7, 7, 0, 0, 3,
};
static byte[] packet4Zone = new byte[]
{
/*01 Z1 Z2 Z3 Z4 NA NA KeyZone */
0, 1, 2, 3, 0, 0,
/*02 RR R RM LM L LL LighBar */
7, 7, 6, 5, 4, 4,
}; };
@@ -455,6 +466,8 @@ namespace GHelper.USB
Array.Clear(keyBuf, 0, keyBuf.Length); Array.Clear(keyBuf, 0, keyBuf.Length);
if (!isStrix4Zone) // per key
{
for (int ledIndex = 0; ledIndex < packetMap.Count(); ledIndex++) for (int ledIndex = 0; ledIndex < packetMap.Count(); ledIndex++)
{ {
ushort offset = (ushort)(3 * packetMap[ledIndex]); ushort offset = (ushort)(3 * packetMap[ledIndex]);
@@ -478,13 +491,28 @@ namespace GHelper.USB
Buffer.BlockCopy(keyBuf, 3 * i, buffer, 9, 3 * buffer[7]); Buffer.BlockCopy(keyBuf, 3 * i, buffer, 9, 3 * buffer[7]);
AsusHid.WriteAura(buffer); AsusHid.WriteAura(buffer);
} }
}
buffer[4] = 0x04; buffer[4] = 0x04;
buffer[5] = 0x00; buffer[5] = 0x00;
buffer[6] = 0x00; buffer[6] = 0x00;
buffer[7] = 0x00; buffer[7] = 0x00;
Buffer.BlockCopy(keyBuf, 3 * keySet, buffer, 9, 3 * (ledCount - keySet));
if (isStrix4Zone) { // per zone
var leds_4_zone = packet4Zone.Count();
for (int ledIndex = 0; ledIndex < leds_4_zone; ledIndex++)
{
byte zone = packet4Zone[ledIndex];
keyBuf[ledIndex * 3] = color[zone].R;
keyBuf[ledIndex * 3 + 1] = color[zone].G;
keyBuf[ledIndex * 3 + 2] = color[zone].B;
}
Buffer.BlockCopy(keyBuf, 0, buffer, 9, 3 * leds_4_zone);
AsusHid.WriteAura(buffer);
return;
}
Buffer.BlockCopy(keyBuf, 3 * keySet, buffer, 9, 3 * (ledCount - keySet));
AsusHid.WriteAura(buffer); AsusHid.WriteAura(buffer);
} }
@@ -534,7 +562,7 @@ namespace GHelper.USB
{ {
CustomRGB.ApplyAmbient(true); CustomRGB.ApplyAmbient(true);
timer.Enabled = true; timer.Enabled = true;
timer.Interval = 120; timer.Interval = 100;
return; return;
} }
@@ -599,13 +627,14 @@ namespace GHelper.USB
bound.Y += bound.Height / 3; bound.Y += bound.Height / 3;
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
var screen_low = AmbientData.CamptureScreen(bound, 256, 144); Bitmap screen_low;
Bitmap screeb_pxl; Bitmap screeb_pxl;
int zones = AURA_ZONES; int zones = AURA_ZONES;
if (isStrix) // laptop with lightbar if (isStrix) // laptop with lightbar
{ {
screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512
screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar
var mid_left = ColorUtils.GetMidColor(screeb_pxl.GetPixel(0, 1), screeb_pxl.GetPixel(1, 1)); var mid_left = ColorUtils.GetMidColor(screeb_pxl.GetPixel(0, 1), screeb_pxl.GetPixel(1, 1));
var mid_right = ColorUtils.GetMidColor(screeb_pxl.GetPixel(2, 1), screeb_pxl.GetPixel(3, 1)); var mid_right = ColorUtils.GetMidColor(screeb_pxl.GetPixel(2, 1), screeb_pxl.GetPixel(3, 1));
@@ -621,6 +650,7 @@ namespace GHelper.USB
else else
{ {
zones = 1; zones = 1;
screen_low = AmbientData.CamptureScreen(bound, 256, 144);
screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1); screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1);
AmbientData.Colors[0].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3); AmbientData.Colors[0].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3);
} }