TDP tweaks

This commit is contained in:
Serge
2024-04-17 12:55:15 +02:00
parent b83fa41772
commit 32c007ada7
2 changed files with 21 additions and 12 deletions

View File

@@ -4,9 +4,10 @@ using GHelper.Input;
using GHelper.Mode; using GHelper.Mode;
using GHelper.USB; using GHelper.USB;
using HidSharp; using HidSharp;
using System.Diagnostics;
using System.Text; using System.Text;
namespace GHelper.Ally namespace GHelper.Ally
{ {
@@ -381,7 +382,7 @@ namespace GHelper.Ally
if (_applyMode != newMode) _autoCount++; if (_applyMode != newMode) _autoCount++;
else _autoCount = 0; else _autoCount = 0;
if (_autoCount > 2) if (_autoCount == 3)
{ {
_autoCount = 0; _autoCount = 0;
ApplyMode(newMode); ApplyMode(newMode);
@@ -575,7 +576,7 @@ namespace GHelper.Ally
DecodeBinding(KeyR2).CopyTo(bindings, 38); DecodeBinding(KeyR2).CopyTo(bindings, 38);
//AsusHid.WriteInput(CommandReady, null); //AsusHid.WriteInput(CommandReady, null);
AsusHid.WriteInput(bindings, $"B{zone}"); AsusHid.WriteInput(bindings, null);
} }
@@ -591,19 +592,19 @@ namespace GHelper.Ally
(byte)AppConfig.Get("ls_max", 100), (byte)AppConfig.Get("ls_max", 100),
(byte)AppConfig.Get("rs_min", 0), (byte)AppConfig.Get("rs_min", 0),
(byte)AppConfig.Get("rs_max", 100) (byte)AppConfig.Get("rs_max", 100)
}, "StickDeadzone"); }, null);
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 5, 4, AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 5, 4,
(byte)AppConfig.Get("lt_min", 0), (byte)AppConfig.Get("lt_min", 0),
(byte)AppConfig.Get("lt_max", 100), (byte)AppConfig.Get("lt_max", 100),
(byte)AppConfig.Get("rt_min", 0), (byte)AppConfig.Get("rt_min", 0),
(byte)AppConfig.Get("rt_max", 100) (byte)AppConfig.Get("rt_max", 100)
}, "TriggerDeadzone"); }, null);
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 6, 2, AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 6, 2,
(byte)AppConfig.Get("vibra", 100), (byte)AppConfig.Get("vibra", 100),
(byte)AppConfig.Get("vibra", 100) (byte)AppConfig.Get("vibra", 100)
}, "Vibration"); }, null);
} }
@@ -668,6 +669,7 @@ namespace GHelper.Ally
_mode = mode; _mode = mode;
AppConfig.Set("controller_mode", (int)mode); AppConfig.Set("controller_mode", (int)mode);
amdControl.StopFPS();
ApplyMode(mode, init); ApplyMode(mode, init);
amdControl.StartFPS(); amdControl.StartFPS();

View File

@@ -218,7 +218,9 @@ namespace GHelper
buttonUpdates.Click += ButtonUpdates_Click; buttonUpdates.Click += ButtonUpdates_Click;
sliderBattery.ValueChanged += SliderBattery_ValueChanged; sliderBattery.MouseUp += SliderBattery_MouseUp;
sliderBattery.KeyUp += SliderBattery_KeyUp;
Program.trayIcon.MouseMove += TrayIcon_MouseMove; Program.trayIcon.MouseMove += TrayIcon_MouseMove;
sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer", 1000)); sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer", 1000));
@@ -266,6 +268,16 @@ namespace GHelper
InitVisual(); InitVisual();
} }
private void SliderBattery_KeyUp(object? sender, KeyEventArgs e)
{
BatteryControl.SetBatteryChargeLimit(sliderBattery.Value);
}
private void SliderBattery_MouseUp(object? sender, MouseEventArgs e)
{
BatteryControl.SetBatteryChargeLimit(sliderBattery.Value);
}
private void ButtonAutoTDP_Click(object? sender, EventArgs e) private void ButtonAutoTDP_Click(object? sender, EventArgs e)
{ {
allyControl.ToggleAutoTDP(); allyControl.ToggleAutoTDP();
@@ -741,11 +753,6 @@ namespace GHelper
gpuControl.ToggleXGM(); gpuControl.ToggleXGM();
} }
private void SliderBattery_ValueChanged(object? sender, EventArgs e)
{
BatteryControl.SetBatteryChargeLimit(sliderBattery.Value);
}
public void SetVersionLabel(string label, bool update = false) public void SetVersionLabel(string label, bool update = false)
{ {