mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
2 Heatmap modes, one can blink, another one don't work on some devices
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using GHelper.Helpers;
|
||||
using HidLibrary;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace GHelper
|
||||
@@ -38,6 +37,7 @@ namespace GHelper
|
||||
public static class AsusUSB
|
||||
{
|
||||
public const int HEATMAP = 20;
|
||||
public const int HEATMAP_ALT = 21;
|
||||
|
||||
public const int ASUS_ID = 0x0b05;
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace GHelper
|
||||
static System.Timers.Timer timer = new System.Timers.Timer(2000);
|
||||
static HidDevice? auraDevice = null;
|
||||
|
||||
static bool Manual = false;
|
||||
|
||||
static byte[] AuraPowerMessage(AuraPower flags)
|
||||
{
|
||||
byte keyb = 0, bar = 0, lid = 0, rear = 0;
|
||||
@@ -169,7 +171,8 @@ namespace GHelper
|
||||
{ 10, Properties.Strings.AuraStrobe},
|
||||
{ 11, "Comet" },
|
||||
{ 12, "Flash" },
|
||||
{ HEATMAP, "Heatmap"}
|
||||
{ HEATMAP, "Heatmap"},
|
||||
{ HEATMAP_ALT, "Heatmap Alt"}
|
||||
};
|
||||
|
||||
|
||||
@@ -473,51 +476,50 @@ namespace GHelper
|
||||
if (auraDevice is null || !auraDevice.IsConnected) GetAuraDevice();
|
||||
if (auraDevice is null || !auraDevice.IsConnected) return;
|
||||
|
||||
byte[] msg = new byte[0x40];
|
||||
int start = 9;
|
||||
|
||||
msg[0] = AURA_HID_ID;
|
||||
msg[1] = 0xbc;
|
||||
msg[2] = 1;
|
||||
msg[3] = 1;
|
||||
msg[4] = 0;
|
||||
|
||||
msg[9] = color.R; // R
|
||||
msg[10] = color.G; // G
|
||||
msg[11] = color.B; // B
|
||||
|
||||
/*
|
||||
for (int i = 0; i < 5; i++)
|
||||
if (Manual)
|
||||
{
|
||||
msg[start + i * 3] = color.R; // R
|
||||
msg[start + 1 + i * 3] = color.G; // G
|
||||
msg[start + 2 + i * 3] = color.B; // B
|
||||
byte[] msg = new byte[0x40];
|
||||
int start = 9;
|
||||
|
||||
msg[0] = AURA_HID_ID;
|
||||
msg[1] = 0xbc;
|
||||
msg[2] = 1;
|
||||
msg[3] = 1;
|
||||
msg[4] = 4;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
msg[start + i * 3] = color.R; // R
|
||||
msg[start + 1 + i * 3] = color.G; // G
|
||||
msg[start + 2 + i * 3] = color.B; // B
|
||||
}
|
||||
|
||||
for (int i = 6; i < 12; i++)
|
||||
{
|
||||
msg[start + i * 3] = color.R; // R
|
||||
msg[start + 1 + i * 3] = color.G; // G
|
||||
msg[start + 2 + i * 3] = color.B; // B
|
||||
}
|
||||
|
||||
if (init)
|
||||
{
|
||||
auraDevice.WriteFeatureData(LED_INIT1);
|
||||
auraDevice.WriteFeatureData(LED_INIT2);
|
||||
auraDevice.WriteFeatureData(LED_INIT3);
|
||||
auraDevice.WriteFeatureData(LED_INIT4);
|
||||
auraDevice.WriteFeatureData(LED_INIT5);
|
||||
auraDevice.WriteFeatureData(PrepareAuraMessage(new byte[] { AURA_HID_ID, 0xbc, 1, 0, 0, 0 }));
|
||||
auraDevice.WriteFeatureData(PrepareAuraMessage(new byte[] { AURA_HID_ID, 0xbc, 1, 1, 4, 0 }));
|
||||
}
|
||||
|
||||
auraDevice.WriteFeatureData(msg);
|
||||
|
||||
} else
|
||||
{
|
||||
auraDevice.WriteFeatureData(AuraMessage(0, color, color, 0));
|
||||
auraDevice.WriteFeatureData(MESSAGE_SET);
|
||||
}
|
||||
|
||||
for (int i = 6; i < 12; i++)
|
||||
{
|
||||
msg[start + i * 3] = color.R; // R
|
||||
msg[start + 1 + i * 3] = color.G; // G
|
||||
msg[start + 2 + i * 3] = color.B; // B
|
||||
}
|
||||
*/
|
||||
|
||||
if (init)
|
||||
{
|
||||
//auraDevice.WriteFeatureData(AuraMessage(0,Color.Red,color,0));
|
||||
//auraDevice.WriteFeatureData(MESSAGE_APPLY);
|
||||
//auraDevice.WriteFeatureData(MESSAGE_SET);
|
||||
|
||||
auraDevice.WriteFeatureData(LED_INIT1);
|
||||
auraDevice.WriteFeatureData(LED_INIT2);
|
||||
auraDevice.WriteFeatureData(LED_INIT3);
|
||||
auraDevice.WriteFeatureData(LED_INIT4);
|
||||
auraDevice.WriteFeatureData(LED_INIT5);
|
||||
auraDevice.WriteFeatureData(PrepareAuraMessage(new byte[] { AURA_HID_ID, 0xbc, 1, 0, 0, 0 }));
|
||||
auraDevice.WriteFeatureData(PrepareAuraMessage(new byte[] { AURA_HID_ID, 0xbc, 1, 1, 0, 0 }));
|
||||
}
|
||||
|
||||
auraDevice.WriteFeatureData(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -529,8 +531,9 @@ namespace GHelper
|
||||
SetColor(AppConfig.Get("aura_color"));
|
||||
SetColor2(AppConfig.Get("aura_color2"));
|
||||
|
||||
if (Mode == HEATMAP)
|
||||
if (Mode == HEATMAP || Mode == HEATMAP_ALT)
|
||||
{
|
||||
Manual = (Mode == HEATMAP_ALT);
|
||||
SetHeatmap(true);
|
||||
timer.Enabled = true;
|
||||
return;
|
||||
|
||||
28
app/Settings.Designer.cs
generated
28
app/Settings.Designer.cs
generated
@@ -173,7 +173,7 @@ namespace GHelper
|
||||
tableLayoutMatrix.Name = "tableLayoutMatrix";
|
||||
tableLayoutMatrix.RowCount = 1;
|
||||
tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
tableLayoutMatrix.Size = new Size(787, 60);
|
||||
tableLayoutMatrix.Size = new Size(787, 64);
|
||||
tableLayoutMatrix.TabIndex = 43;
|
||||
//
|
||||
// comboMatrix
|
||||
@@ -215,8 +215,8 @@ namespace GHelper
|
||||
buttonMatrix.Dock = DockStyle.Top;
|
||||
buttonMatrix.FlatAppearance.BorderSize = 0;
|
||||
buttonMatrix.FlatStyle = FlatStyle.Flat;
|
||||
buttonMatrix.Location = new Point(528, 6);
|
||||
buttonMatrix.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonMatrix.Location = new Point(528, 8);
|
||||
buttonMatrix.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonMatrix.Name = "buttonMatrix";
|
||||
buttonMatrix.Secondary = true;
|
||||
buttonMatrix.Size = new Size(255, 48);
|
||||
@@ -276,7 +276,7 @@ namespace GHelper
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(panelBatteryTitle);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(11, 1261);
|
||||
panelBattery.Location = new Point(11, 1265);
|
||||
panelBattery.Margin = new Padding(0);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -350,7 +350,7 @@ namespace GHelper
|
||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFooter.Controls.Add(tableButtons);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(11, 1431);
|
||||
panelFooter.Location = new Point(11, 1435);
|
||||
panelFooter.Margin = new Padding(0);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(20);
|
||||
@@ -1022,7 +1022,7 @@ namespace GHelper
|
||||
panelKeyboard.Margin = new Padding(0);
|
||||
panelKeyboard.Name = "panelKeyboard";
|
||||
panelKeyboard.Padding = new Padding(20);
|
||||
panelKeyboard.Size = new Size(827, 140);
|
||||
panelKeyboard.Size = new Size(827, 144);
|
||||
panelKeyboard.TabIndex = 3;
|
||||
//
|
||||
// tableLayoutKeyboard
|
||||
@@ -1042,7 +1042,7 @@ namespace GHelper
|
||||
tableLayoutKeyboard.Name = "tableLayoutKeyboard";
|
||||
tableLayoutKeyboard.RowCount = 1;
|
||||
tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
tableLayoutKeyboard.Size = new Size(787, 60);
|
||||
tableLayoutKeyboard.Size = new Size(787, 64);
|
||||
tableLayoutKeyboard.TabIndex = 39;
|
||||
//
|
||||
// buttonKeyboard
|
||||
@@ -1057,8 +1057,8 @@ namespace GHelper
|
||||
buttonKeyboard.FlatStyle = FlatStyle.Flat;
|
||||
buttonKeyboard.Image = Properties.Resources.icons8_settings_32;
|
||||
buttonKeyboard.ImageAlign = ContentAlignment.MiddleRight;
|
||||
buttonKeyboard.Location = new Point(528, 6);
|
||||
buttonKeyboard.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonKeyboard.Location = new Point(528, 8);
|
||||
buttonKeyboard.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonKeyboard.Name = "buttonKeyboard";
|
||||
buttonKeyboard.Secondary = true;
|
||||
buttonKeyboard.Size = new Size(255, 48);
|
||||
@@ -1074,8 +1074,8 @@ namespace GHelper
|
||||
panelColor.Controls.Add(pictureColor);
|
||||
panelColor.Controls.Add(buttonKeyboardColor);
|
||||
panelColor.Dock = DockStyle.Fill;
|
||||
panelColor.Location = new Point(266, 6);
|
||||
panelColor.Margin = new Padding(4, 6, 4, 6);
|
||||
panelColor.Location = new Point(266, 8);
|
||||
panelColor.Margin = new Padding(4, 8, 4, 8);
|
||||
panelColor.Name = "panelColor";
|
||||
panelColor.Size = new Size(254, 48);
|
||||
panelColor.TabIndex = 36;
|
||||
@@ -1111,7 +1111,7 @@ namespace GHelper
|
||||
buttonKeyboardColor.FlatStyle = FlatStyle.Flat;
|
||||
buttonKeyboardColor.ForeColor = SystemColors.ControlText;
|
||||
buttonKeyboardColor.Location = new Point(0, 0);
|
||||
buttonKeyboardColor.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
||||
buttonKeyboardColor.Secondary = false;
|
||||
buttonKeyboardColor.Size = new Size(254, 48);
|
||||
@@ -1188,7 +1188,7 @@ namespace GHelper
|
||||
panelVersion.Controls.Add(labelVersion);
|
||||
panelVersion.Controls.Add(checkStartup);
|
||||
panelVersion.Dock = DockStyle.Top;
|
||||
panelVersion.Location = new Point(11, 1375);
|
||||
panelVersion.Location = new Point(11, 1379);
|
||||
panelVersion.Margin = new Padding(4);
|
||||
panelVersion.Name = "panelVersion";
|
||||
panelVersion.Size = new Size(827, 56);
|
||||
@@ -1201,7 +1201,7 @@ namespace GHelper
|
||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||
panelPeripherals.Dock = DockStyle.Top;
|
||||
panelPeripherals.Location = new Point(11, 1063);
|
||||
panelPeripherals.Location = new Point(11, 1067);
|
||||
panelPeripherals.Margin = new Padding(0);
|
||||
panelPeripherals.Name = "panelPeripherals";
|
||||
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
||||
|
||||
Reference in New Issue
Block a user