From 659a408225a0bb366e796bd8b649cfdd1ee24dac Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Wed, 2 Aug 2023 10:32:25 +0200 Subject: [PATCH 1/4] Disable packet logger for release builds. --- app/Peripherals/Mouse/AsusMouse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 0ffb00b4..898ea05f 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -140,7 +140,7 @@ namespace GHelper.Peripherals.Mouse public abstract class AsusMouse : Device, IPeripheral { private static string[] POLLING_RATES = { "125 Hz", "250 Hz", "500 Hz", "1000 Hz", "2000 Hz", "4000 Hz", "8000 Hz", "16000 Hz" }; - internal const bool PACKET_LOGGER_ALWAYS_ON = true; + internal const bool PACKET_LOGGER_ALWAYS_ON = false; internal const int ASUS_MOUSE_PACKET_SIZE = 65; public event EventHandler? Disconnect; From 977e7cc8c4a98937813794980b983df131659c50 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Wed, 2 Aug 2023 21:44:03 +0200 Subject: [PATCH 2/4] Angle tuning limits are now variable and can be overriden per mouse. --- app/AsusMouseSettings.cs | 3 +++ app/Peripherals/Mouse/AsusMouse.cs | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 025b15b0..7d71966d 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -503,6 +503,9 @@ namespace GHelper { labelAngleAdjustmentValue.Visible = false; sliderAngleAdjustment.Visible = false; + sliderAngleAdjustment.Max = mouse.AngleTuningMax(); + sliderAngleAdjustment.Min = mouse.AngleTuningMin(); + sliderAngleAdjustment.Step = mouse.AngleTuningStep(); } if (!mouse.HasAngleTuning() && !mouse.HasAngleSnapping()) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 898ea05f..bfd4db26 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -615,6 +615,21 @@ namespace GHelper.Peripherals.Mouse return false; } + public virtual int AngleTuningStep() + { + return 1; + } + + public virtual int AngleTuningMin() + { + return -20; + } + + public virtual int AngleTuningMax() + { + return 20; + } + public virtual string PollingRateDisplayString(PollingRate pollingRate) { return POLLING_RATES[(int)pollingRate]; @@ -762,9 +777,10 @@ namespace GHelper.Peripherals.Mouse return; } - if (angleAdjustment < -20 || angleAdjustment > 20) + if (angleAdjustment < AngleTuningMin() || angleAdjustment > AngleTuningMax()) { - Logger.WriteLine(GetDisplayName() + ": Angle Adjustment:" + angleAdjustment + " is outside of range [-20;20]."); + Logger.WriteLine(GetDisplayName() + ": Angle Adjustment:" + angleAdjustment + + " is outside of range [" + AngleTuningMin() + "; " + AngleTuningMax() + "]."); return; } From dcecfbaeda63594ca72544f2a0746a5931333de8 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:21:12 +0200 Subject: [PATCH 3/4] Heatmap cleanup --- app/AsusUSB.cs | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/app/AsusUSB.cs b/app/AsusUSB.cs index 20177db8..77a7f5e9 100644 --- a/app/AsusUSB.cs +++ b/app/AsusUSB.cs @@ -38,7 +38,6 @@ namespace GHelper public static class AsusUSB { public const int HEATMAP = 20; - public const int HEATMAP_ALT = 21; public const int ASUS_ID = 0x0b05; @@ -172,8 +171,7 @@ namespace GHelper { 10, Properties.Strings.AuraStrobe}, { 11, "Comet" }, { 12, "Flash" }, - { HEATMAP, "Heatmap"}, - { HEATMAP_ALT, "Heatmap Alt"} + { HEATMAP, "Heatmap"} }; @@ -458,13 +456,6 @@ namespace GHelper } } - static byte[] PrepareAuraMessage(byte[] msg) - { - var buffer = new byte[0x40]; - Array.Copy(msg, buffer, msg.Length); - return buffer; - } - public static void ApplyColor(Color color, bool init = false) { @@ -477,10 +468,12 @@ namespace GHelper if (auraDevice is null || !auraDevice.IsConnected) GetAuraDevice(); if (auraDevice is null || !auraDevice.IsConnected) return; - if (Manual) + if (isStrix) { byte[] msg = new byte[0x40]; - int start = 9; + + byte start = 9; + byte maxLeds = 0x93; msg[0] = AURA_HID_ID; msg[1] = 0xbc; @@ -491,7 +484,7 @@ namespace GHelper msg[6] = 0; msg[7] = 0x10; - for (int i = 0; i < 0x12; i++) + for (byte i = 0; i < 0x12; i++) { msg[start + i * 3] = color.R; // R msg[start + 1 + i * 3] = color.G; // G @@ -509,24 +502,22 @@ namespace GHelper auraDevice.Write(new byte[] { AURA_HID_ID, 0xbc}); } - for (byte b = 0; b <= 0xA0; b += 0x10) + for (byte b = 0; b < maxLeds; b += 0x10) { msg[6] = b; auraDevice.Write(msg); - //Debug.WriteLine(BitConverter.ToString(msg)); } + msg[6] = maxLeds; + auraDevice.Write(msg); + msg[4] = 4; msg[5] = 0; msg[6] = 0; msg[7] = 0; - auraDevice.Write(msg); - - //auraDevice.Write(new byte[] { AURA_HID_ID, 0xbc, 1, 0, 0 }); - - } + else { auraDevice.Write(AuraMessage(0, color, color, 0)); @@ -544,9 +535,8 @@ namespace GHelper SetColor(AppConfig.Get("aura_color")); SetColor2(AppConfig.Get("aura_color2")); - if (Mode == HEATMAP || Mode == HEATMAP_ALT) + if (Mode == HEATMAP) { - Manual = (Mode == HEATMAP_ALT); SetHeatmap(true); timer.Enabled = true; return; From 3c4a6c5e95463bd61cec067411c908d43d1c8c09 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Thu, 3 Aug 2023 17:05:26 +0200 Subject: [PATCH 4/4] Added TUF Gaming M3 --- app/Peripherals/Mouse/Models/TUFM3.cs | 112 +++++++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 1 + 2 files changed, 113 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/TUFM3.cs diff --git a/app/Peripherals/Mouse/Models/TUFM3.cs b/app/Peripherals/Mouse/Models/TUFM3.cs new file mode 100644 index 00000000..d7c2443e --- /dev/null +++ b/app/Peripherals/Mouse/Models/TUFM3.cs @@ -0,0 +1,112 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P306_Wireless + public class TUFM3 : AsusMouse + { + public TUFM3() : base(0x0B05, 0x1910, "mi_01", false) + { + } + + public override int DPIProfileCount() + { + return 4; + } + + public override string GetDisplayName() + { + return "TUF GAMING M3"; + } + + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + //Mouse has React mapped to 0x03 instead of 0x04 like other mice + protected override byte IndexForLightingMode(LightingMode lightingMode) + { + if (lightingMode == LightingMode.React) + { + return 0x03; + } + return ((byte)lightingMode); + } + + //Mouse has React mapped to 0x03 instead of 0x04 like other mice + protected override LightingMode LightingModeForIndex(byte lightingMode) + { + if (lightingMode == 0x03) + { + return LightingMode.React; + } + return base.LightingModeForIndex(lightingMode); + + } + + public override int ProfileCount() + { + return 1; + } + public override int MaxDPI() + { + return 7_000; + } + public override bool HasBattery() + { + return false; + } + + public override bool HasLiftOffSetting() + { + return false; + } + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo }; + } + + public override bool HasRGB() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override int DPIIncrements() + { + return 100; + } + + public override bool CanChangeDPIProfile() + { + return true; + } + + public override bool HasDebounceSetting() + { + return true; + } + + public override int MaxBrightness() + { + return 4; + } + + public override bool IsLightingModeSupported(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.ColorCycle + || lightingMode == LightingMode.React; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 05ed687b..b7f18ffa 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -194,6 +194,7 @@ namespace GHelper.Peripherals DetectMouse(new StrixImpactIIWirelessWired()); DetectMouse(new GladiusIII()); DetectMouse(new GladiusIIIWired()); + DetectMouse(new TUFM3()); } public static void DetectMouse(AsusMouse am)