This commit is contained in:
Serge
2023-08-03 17:15:49 +02:00
5 changed files with 147 additions and 25 deletions

View File

@@ -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())

View File

@@ -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;

View File

@@ -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;
@@ -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;
}

View File

@@ -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;
}
}
}

View File

@@ -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)