diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index 1d7cc6f8..c9402a82 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -59,18 +59,6 @@ namespace GHelper.AnimeMatrix if (deviceSlash is not null) SetSlash(wakeUp); } - public void SetLidMode(bool force = false) - { - bool matrixLid = AppConfig.Is("matrix_lid"); - if (matrixLid || force) - { - Logger.WriteLine($"Matrix LidClosed: {lidClose}"); - if (deviceSlash is not null) deviceSlash.SetLidMode(matrixLid); - SetDevice(true); - } - } - - public void SetSlash(bool wakeUp = false) { if (deviceSlash is null) return; @@ -110,16 +98,44 @@ namespace GHelper.AnimeMatrix } deviceSlash.Init(); - deviceSlash.SetMode((SlashMode)running); - deviceSlash.SetOptions(true, brightness, inteval); - deviceSlash.Save(); + + switch ((SlashMode)running) + { + case SlashMode.Static: + deviceSlash.SetStatic(); + deviceSlash.Save(); + break; + default: + deviceSlash.SetMode((SlashMode)running); + deviceSlash.SetOptions(true, brightness, inteval); + deviceSlash.Save(); + break; + } } }); } + public void SetLidMode(bool force = false) + { + bool matrixLid = AppConfig.Is("matrix_lid"); + if (deviceSlash is not null) deviceSlash.SetLidMode(matrixLid); + + if (matrixLid || force) + { + Logger.WriteLine($"Matrix LidClosed: {lidClose}"); + SetDevice(true); + } + } + public void SetBatteryAuto() { - if (deviceSlash is not null) deviceSlash.SetBatterySaver(AppConfig.Is("matrix_auto")); + if (deviceSlash is not null) + { + bool auto = AppConfig.Is("matrix_auto"); + deviceSlash.SetBatterySaver(auto); + if (!auto) SetSlash(); + } + if (deviceMatrix is not null) SetMatrix(); } diff --git a/app/AnimeMatrix/SlashDevice.cs b/app/AnimeMatrix/SlashDevice.cs index f8b028f4..4cc9bf1a 100644 --- a/app/AnimeMatrix/SlashDevice.cs +++ b/app/AnimeMatrix/SlashDevice.cs @@ -19,7 +19,8 @@ namespace GHelper.AnimeMatrix Ramp, GameOver, Start, - Buzzer + Buzzer, + Static } internal class SlashPacket : Packet @@ -53,6 +54,7 @@ namespace GHelper.AnimeMatrix { SlashMode.GameOver, "Game Over"}, { SlashMode.Start, "Start"}, { SlashMode.Buzzer, "Buzzer"}, + { SlashMode.Static, "Static"}, }; private static Dictionary modeCodes = new Dictionary @@ -115,6 +117,12 @@ namespace GHelper.AnimeMatrix Set(Packet(0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13), "SlashMode"); } + public void SetStatic() + { + Set(Packet(0xD3, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), "StaticWhite"); + Set(Packet(0xD3, 0x00, 0x00, 0x01, 0xAC), "Static"); + } + public void SetOptions(bool status, int brightness = 0, int interval = 0) { byte brightnessByte = (byte)(brightness * 85.333); diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 86d7a674..03af8cf4 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -404,9 +404,14 @@ public static class AppConfig return ContainsModel("GA503") || IsSlash(); } + public static bool IsInvertedFNLock() + { + return ContainsModel("M140"); + } + public static bool IsOLED() { - return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("K340") || ContainsModel("K350"); + return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("K340") || ContainsModel("K350") || ContainsModel("M140"); } public static bool IsNoOverdrive() @@ -426,7 +431,7 @@ public static class AppConfig public static bool IsStrixLimitedRGB() { - return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb"); + return (ContainsModel("G614JV_") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb"); } diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 928ebdb3..0208481f 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.166 + 0.167 diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index f7211a69..a9003a95 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -85,7 +85,8 @@ namespace GHelper.Input InitBacklightTimer(); - if (AppConfig.IsVivoZenbook()) Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ? 1 : 0, "FnLock"); + if (AppConfig.IsVivoZenbook()) + Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ^ AppConfig.IsInvertedFNLock() ? 1 : 0, "FnLock"); } @@ -585,17 +586,17 @@ namespace GHelper.Input public static void ToggleFnLock() { - int fnLock = AppConfig.Is("fn_lock") ? 0 : 1; - AppConfig.Set("fn_lock", fnLock); + bool fnLock = !AppConfig.Is("fn_lock"); + AppConfig.Set("fn_lock", fnLock ? 1 : 0); if (AppConfig.IsVivoZenbook()) - Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock == 1 ? 1 : 0, "FnLock"); + Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock ^ AppConfig.IsInvertedFNLock() ? 1 : 0, "FnLock"); else Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys); Program.settingsForm.BeginInvoke(Program.settingsForm.VisualiseFnLock); - Program.toast.RunToast(fnLock == 1 ? Properties.Strings.FnLockOn : Properties.Strings.FnLockOff, ToastIcon.FnLock); + Program.toast.RunToast(fnLock ? Properties.Strings.FnLockOn : Properties.Strings.FnLockOff, ToastIcon.FnLock); } public static void TabletMode() diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index 389955ba..47f0d40c 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -507,7 +507,7 @@ 亮度 - Lock Screen + 鎖定螢幕 Logo