From 27b78ba1cf8a580bc02b36eb88c5fa7183bc6105 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 22 Dec 2023 20:53:51 +0100 Subject: [PATCH] Aura tweaks --- app/USB/Aura.cs | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index cca87adb8..b932ed74e 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -465,7 +465,6 @@ public static void ApplyDirect(Color[] color, bool init = false) { Init(); AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc }); - AsusHid.WriteAura(MESSAGE_APPLY); } Array.Clear(keyBuf, 0, keyBuf.Length); @@ -521,7 +520,7 @@ public static void ApplyDirect(Color[] color, bool init = false) } - public static void ApplyColor(Color color, bool init = false) + public static void ApplyDirect(Color color, bool init = false) { if (isACPI) @@ -535,26 +534,23 @@ public static void ApplyColor(Color color, bool init = false) ApplyDirect(Enumerable.Repeat(color, AURA_ZONES).ToArray(), init); return; } - else + + if (init) { - if (init) - { - Init(); - AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc }); - AsusHid.WriteAura(MESSAGE_APPLY); - } + Init(); + AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 }); + } - byte[] buffer = new byte[64]; - buffer[0] = AsusHid.AURA_ID; - buffer[1] = 0xbc; - buffer[2] = 1; - buffer[3] = 1; - buffer[9] = color.R; - buffer[10] = color.G; - buffer[11] = color.B; + byte[] buffer = new byte[64]; + buffer[0] = AsusHid.AURA_ID; + buffer[1] = 0xbc; + buffer[2] = 1; + buffer[3] = 1; + buffer[9] = color.R; + buffer[10] = color.G; + buffer[11] = color.B; - AsusHid.WriteAura(buffer); - } + AsusHid.WriteAura(buffer); } @@ -582,7 +578,7 @@ public static void ApplyAura() { CustomRGB.ApplyAmbient(true); timer.Enabled = true; - timer.Interval = 100; + timer.Interval = 120; return; } @@ -612,13 +608,13 @@ public static void ApplyGPUColor() switch (GPUModeControl.gpuMode) { case AsusACPI.GPUModeUltimate: - ApplyColor(Color.Red, true); + ApplyDirect(Color.Red, true); break; case AsusACPI.GPUModeEco: - ApplyColor(Color.Green, true); + ApplyDirect(Color.Green, true); break; default: - ApplyColor(Color.Yellow, true); + ApplyDirect(Color.Yellow, true); break; } } @@ -636,7 +632,7 @@ public static void ApplyHeatmap(bool init = false) else if (cpuTemp < hot) color = ColorUtils.GetWeightedAverage(Color.Yellow, Color.Red, ((float)cpuTemp - warm) / (hot - warm)); else color = Color.Red; - ApplyColor(color, init); + ApplyDirect(color, init); } @@ -688,7 +684,7 @@ public static void ApplyAmbient(bool init = false) if (is_fresh) { if (isStrix) ApplyDirect(AmbientData.result, init); - else ApplyColor(AmbientData.result[0], init); + else ApplyDirect(AmbientData.result[0], init); } }