From 8f59ff5e3d2039d442cbb2aa2cb75e47541c83d1 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 31 Jul 2023 18:21:28 +0200 Subject: [PATCH] Adds support for Gladius III Wireless (P706_Wireless). Renamed the other Gladius III (Wireless Aimpoint) to differentiate them. Fixes a crashbug that can occurs when opening the --- app/AsusMouseSettings.cs | 27 +++--- app/Peripherals/Mouse/Models/GladiusIII.cs | 91 +++++++++++++++++++ .../Mouse/Models/GladiusIIIAimpoint.cs | 5 +- app/Peripherals/PeripheralsProvider.cs | 2 + 4 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 app/Peripherals/Mouse/Models/GladiusIII.cs diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 48a2b899..025b15b0 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -196,7 +196,7 @@ namespace GHelper } mouse.SetProfile(comboProfile.SelectedIndex); - Task task = Task.Run((Action)RefreshMouseData); + RefreshMouseData(); } private void ComboBoxPollingRate_DropDownClosed(object? sender, EventArgs e) @@ -408,13 +408,13 @@ namespace GHelper private void Mouse_Disconnect(object? sender, EventArgs e) { + if (Disposing || IsDisposed) + { + return; + } //Mouse disconnected. Bye bye. this.Invoke(delegate { - if (Disposing || IsDisposed) - { - return; - } this.Close(); }); @@ -428,18 +428,17 @@ namespace GHelper if (!mouse.IsDeviceReady) { Logger.WriteLine(mouse.GetDisplayName() + " (GUI): Mouse is not ready. Closing view."); - this.Invoke(delegate - { - this.Close(); - }); + Mouse_Disconnect(this, EventArgs.Empty); return; } - this.Invoke(delegate + if (Disposing || IsDisposed) { - VisualizeMouseSettings(); - VisualizeBatteryState(); - }); + return; + } + + VisualizeMouseSettings(); + VisualizeBatteryState(); } private void InitMouseCapabilities() @@ -821,7 +820,7 @@ namespace GHelper private void ButtonSync_Click(object sender, EventArgs e) { - Task task = Task.Run((Action)RefreshMouseData); + RefreshMouseData(); } } } diff --git a/app/Peripherals/Mouse/Models/GladiusIII.cs b/app/Peripherals/Mouse/Models/GladiusIII.cs new file mode 100644 index 00000000..3539582a --- /dev/null +++ b/app/Peripherals/Mouse/Models/GladiusIII.cs @@ -0,0 +1,91 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P706_Wireless + public class GladiusIII : AsusMouse + { + public GladiusIII() : base(0x0B05, 0x197F, "mi_00", true) + { + } + + protected GladiusIII(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) + { + } + + public override int DPIProfileCount() + { + return 4; + } + + public override string GetDisplayName() + { + return "ROG Gladius III (Wireless)"; + } + + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + public override int ProfileCount() + { + return 5; + } + public override int MaxDPI() + { + return 26_000; + } + + public override bool HasDebounceSetting() + { + return true; + } + + public override bool HasLiftOffSetting() + { + return true; + } + + public override bool HasRGB() + { + return true; + } + + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow }; + } + + public override bool HasAutoPowerOff() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override bool HasLowBatteryWarning() + { + return true; + } + } + + public class GladiusIIIWired : GladiusIII + { + public GladiusIIIWired() : base(0x197d, false) + { + } + + public override string GetDisplayName() + { + return "ROG Gladius III (Wired)"; + } + } +} diff --git a/app/Peripherals/Mouse/Models/GladiusIIIAimpoint.cs b/app/Peripherals/Mouse/Models/GladiusIIIAimpoint.cs index f1b8a731..f03dce95 100644 --- a/app/Peripherals/Mouse/Models/GladiusIIIAimpoint.cs +++ b/app/Peripherals/Mouse/Models/GladiusIIIAimpoint.cs @@ -1,5 +1,6 @@ namespace GHelper.Peripherals.Mouse.Models { + //P711 public class GladiusIIIAimpoint : AsusMouse { public GladiusIIIAimpoint() : base(0x0B05, 0x1A70, "mi_00", true) @@ -17,7 +18,7 @@ public override string GetDisplayName() { - return "ROG Gladius III (Wireless)"; + return "ROG Gladius III Aimpoint (Wireless)"; } @@ -99,7 +100,7 @@ public override string GetDisplayName() { - return "ROG Gladius III (Wired)"; + return "ROG Gladius III Aimpoint (Wired)"; } } } diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 5929a9ad..05ed687b 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -192,6 +192,8 @@ namespace GHelper.Peripherals DetectMouse(new TUFM4Wirelss()); DetectMouse(new StrixImpactIIWireless()); DetectMouse(new StrixImpactIIWirelessWired()); + DetectMouse(new GladiusIII()); + DetectMouse(new GladiusIIIWired()); } public static void DetectMouse(AsusMouse am)