diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 15695ea9..a1520c6b 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -648,7 +648,7 @@ namespace GHelper.Ally if (init) { WakeUp(); - InputDispatcher.SetBacklightAuto(true); + InputDispatcher.SetBacklightAuto(); } AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode], "Controller"); diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 278f849d..39cbe955 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -873,11 +873,22 @@ namespace GHelper.Input return Math.Max(Math.Min(3, backlight), 0); } - public static void SetBacklightAuto(bool init = false) + public static void AutoKeyboard() + { + if (AppConfig.HasTabletMode()) TabletMode(); + if (lidClose || AppConfig.Is("skip_aura")) return; + + Aura.Init(); + Aura.ApplyPower(); + Aura.ApplyAura(); + SetBacklightAuto(); + } + + + public static void SetBacklightAuto() { if (lidClose) return; - if (init) Aura.Init(); - Aura.ApplyBrightness(GetBacklight(), "Auto", init); + Aura.ApplyBrightness(GetBacklight(), "Auto"); } public static void SetBacklight(int delta, bool force = false) diff --git a/app/Program.cs b/app/Program.cs index 4ec994e9..1f938859 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -6,6 +6,7 @@ using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; using GHelper.Peripherals; +using GHelper.USB; using Microsoft.Win32; using Ryzen; using System.Diagnostics; @@ -258,9 +259,10 @@ namespace GHelper } else { - settingsForm.AutoKeyboard(); + InputDispatcher.AutoKeyboard(); } + XGM.InitLight(); VisualControl.InitBrightness(); return true; diff --git a/app/Settings.cs b/app/Settings.cs index 7b06ba3c..aee0b9db 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1541,24 +1541,6 @@ namespace GHelper } - public void AutoKeyboard() - { - - if (!AppConfig.Is("skip_aura")) - { - Aura.ApplyPower(); - Aura.ApplyAura(); - } - - InputDispatcher.SetBacklightAuto(true); - - if (Program.acpi.IsXGConnected()) - XGM.Light(AppConfig.Is("xmg_light")); - - if (AppConfig.HasTabletMode()) InputDispatcher.TabletMode(); - - } - public void VisualizeXGM(int GPUMode = -1) { diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 793c02ca..255faf29 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -361,6 +361,11 @@ namespace GHelper.USB AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura"); } + public static void ApplyPowerOff() + { + AsusHid.Write(AuraPowerMessage(new AuraPower())); + } + public static void ApplyPower() { diff --git a/app/USB/XGM.cs b/app/USB/XGM.cs index 4bf3f76d..f4edd955 100644 --- a/app/USB/XGM.cs +++ b/app/USB/XGM.cs @@ -52,6 +52,10 @@ namespace GHelper.USB Write(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 }); } + public static void InitLight() + { + if (Program.acpi.IsXGConnected()) Light(AppConfig.Is("xmg_light")); + } public static void Reset() {