Skip to content

Commit

Permalink
2 Heatmap modes, one can blink, another one don't work on some devices
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Aug 1, 2023
1 parent 409febb commit f32f70f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 54 deletions.
83 changes: 43 additions & 40 deletions app/AsusUSB.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using GHelper.Helpers;
using HidLibrary;
using System.Diagnostics;
using System.Text;

namespace GHelper
Expand Down Expand Up @@ -38,6 +37,7 @@ public class AuraPower
public static class AsusUSB
{
public const int HEATMAP = 20;
public const int HEATMAP_ALT = 21;

public const int ASUS_ID = 0x0b05;

Expand Down Expand Up @@ -67,6 +67,8 @@ public static class AsusUSB
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;
Expand Down Expand Up @@ -169,7 +171,8 @@ public static Dictionary<int, string> GetSpeeds()
{ 10, Properties.Strings.AuraStrobe},
{ 11, "Comet" },
{ 12, "Flash" },
{ HEATMAP, "Heatmap"}
{ HEATMAP, "Heatmap"},
{ HEATMAP_ALT, "Heatmap Alt"}
};


Expand Down Expand Up @@ -473,51 +476,50 @@ public static void ApplyColor(Color color, bool init = false)
if (auraDevice is null || !auraDevice.IsConnected) GetAuraDevice();
if (auraDevice is null || !auraDevice.IsConnected) return;

byte[] msg = new byte[0x40];
int start = 9;
if (Manual)
{
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[0] = AURA_HID_ID;
msg[1] = 0xbc;
msg[2] = 1;
msg[3] = 1;
msg[4] = 4;

msg[9] = color.R; // R
msg[10] = color.G; // G
msg[11] = color.B; // B
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 = 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
}

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);

if (init)
} else
{
//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(AuraMessage(0, color, color, 0));
auraDevice.WriteFeatureData(MESSAGE_SET);
}

auraDevice.WriteFeatureData(msg);
}


Expand All @@ -529,8 +531,9 @@ public static void ApplyAura()
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;
Expand Down
28 changes: 14 additions & 14 deletions app/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f32f70f

Please sign in to comment.