From 32c007ada759916a61cc10f6deb56f3cb25db7af Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:55:15 +0200 Subject: [PATCH] TDP tweaks --- app/Ally/AllyControl.cs | 14 ++++++++------ app/Settings.cs | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index e8c5ee12..61741b3b 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -4,9 +4,10 @@ using GHelper.Input; using GHelper.Mode; using GHelper.USB; using HidSharp; -using System.Diagnostics; using System.Text; + + namespace GHelper.Ally { @@ -381,7 +382,7 @@ namespace GHelper.Ally if (_applyMode != newMode) _autoCount++; else _autoCount = 0; - if (_autoCount > 2) + if (_autoCount == 3) { _autoCount = 0; ApplyMode(newMode); @@ -575,7 +576,7 @@ namespace GHelper.Ally DecodeBinding(KeyR2).CopyTo(bindings, 38); //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("rs_min", 0), (byte)AppConfig.Get("rs_max", 100) - }, "StickDeadzone"); + }, null); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 5, 4, (byte)AppConfig.Get("lt_min", 0), (byte)AppConfig.Get("lt_max", 100), (byte)AppConfig.Get("rt_min", 0), (byte)AppConfig.Get("rt_max", 100) - }, "TriggerDeadzone"); + }, null); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 6, 2, (byte)AppConfig.Get("vibra", 100), (byte)AppConfig.Get("vibra", 100) - }, "Vibration"); + }, null); } @@ -668,6 +669,7 @@ namespace GHelper.Ally _mode = mode; AppConfig.Set("controller_mode", (int)mode); + amdControl.StopFPS(); ApplyMode(mode, init); amdControl.StartFPS(); diff --git a/app/Settings.cs b/app/Settings.cs index 274c42f8..cb425f35 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -218,7 +218,9 @@ namespace GHelper buttonUpdates.Click += ButtonUpdates_Click; - sliderBattery.ValueChanged += SliderBattery_ValueChanged; + sliderBattery.MouseUp += SliderBattery_MouseUp; + sliderBattery.KeyUp += SliderBattery_KeyUp; + Program.trayIcon.MouseMove += TrayIcon_MouseMove; sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer", 1000)); @@ -266,6 +268,16 @@ namespace GHelper 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) { allyControl.ToggleAutoTDP(); @@ -741,11 +753,6 @@ namespace GHelper gpuControl.ToggleXGM(); } - private void SliderBattery_ValueChanged(object? sender, EventArgs e) - { - BatteryControl.SetBatteryChargeLimit(sliderBattery.Value); - } - public void SetVersionLabel(string label, bool update = false) {