From 42a598f177d44e1d3723e097701ec9dbc5ee7101 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:22:11 +0100 Subject: [PATCH] Aura tweaks --- app/USB/Aura.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index d5faf33f..c1ae8971 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -73,7 +73,8 @@ namespace GHelper.USB private static AuraMode mode = AuraMode.AuraStatic; private static AuraSpeed speed = AuraSpeed.Normal; - private static int _brightness = 0; + private static bool backlight = false; + private static bool initDirect = false; public static Color Color1 = Color.White; public static Color Color2 = Color.Black; @@ -291,7 +292,7 @@ namespace GHelper.USB public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false) { - _brightness = brightness; + if (brightness == 0) backlight = false; Task.Run(async () => { @@ -305,6 +306,13 @@ namespace GHelper.USB if (AppConfig.IsAlly()) ApplyAura(); + if (brightness > 0) + { + if (!backlight) initDirect = true; + backlight = true; + + } + }); @@ -498,7 +506,7 @@ namespace GHelper.USB public static void ApplyDirect(Color[] color, bool init = false) { - if (_brightness <= 0) return; + if (!backlight) return; const byte keySet = 167; const byte ledCount = 178; @@ -517,9 +525,9 @@ namespace GHelper.USB buffer[6] = 0; buffer[7] = 0x10; - if (init) + if (init || initDirect) { - Init(); + initDirect = false; AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC }); } @@ -580,7 +588,7 @@ namespace GHelper.USB public static void ApplyDirect(Color color, bool init = false) { - if (_brightness <= 0) return; + if (!backlight) return; if (isACPI) { @@ -600,9 +608,9 @@ namespace GHelper.USB return; } - if (init) + if (init || initDirect) { - //Init(); + initDirect = false; AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 }); } @@ -729,7 +737,7 @@ namespace GHelper.USB public static void ApplyAmbient(bool init = false) { - if (_brightness <= 0) return; + if (!backlight) return; var bound = Screen.GetBounds(Point.Empty); bound.Y += bound.Height / 3;