From ce01d72db0f6d95d49ba82ae70f58ee4d7b9e791 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:56:38 +0200 Subject: [PATCH 1/3] Improved Ally Auto Controller mode --- app/Ally/AllyControl.cs | 6 ++++-- app/Gpu/AMD/AmdGpuControl.cs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index d2141814..b29d2681 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -347,6 +347,7 @@ namespace GHelper.Ally if (!autoTDP && _mode != ControllerMode.Auto) return; float fps = amdControl.GetFPS(); + int? usage = 0; if (autoTDP && fpsLimit > 0 && fpsLimit <= 120) { @@ -377,7 +378,8 @@ namespace GHelper.Ally if (_mode == ControllerMode.Auto) { - ControllerMode newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse; + if (fps > 0) usage = amdControl.GetiGpuUse(); + ControllerMode newMode = (fps > 0 && usage > 15) ? ControllerMode.Gamepad : ControllerMode.Mouse; if (_applyMode != newMode) _autoCount++; else _autoCount = 0; @@ -386,7 +388,7 @@ namespace GHelper.Ally { _autoCount = 0; ApplyMode(newMode); - Logger.WriteLine($"Controller Mode {fps}: {newMode}"); + Logger.WriteLine($"Controller Mode (FPS={fps}, USAGE={usage}%): {newMode}"); } } diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index e10bf191..3f774203 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -119,6 +119,18 @@ public class AmdGpuControl : IGpuControl } + public int? GetiGpuUse() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return null; + if (ADL2_New_QueryPMLogData_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, out ADLPMLogDataOutput adlpmLogDataOutput) != Adl2.ADL_SUCCESS) return null; + + ADLSingleSensorData gpuUsage = adlpmLogDataOutput.Sensors[(int)ADLSensorType.PMLOG_INFO_ACTIVITY_GFX]; + if (gpuUsage.Supported == 0) return null; + + return gpuUsage.Value; + + } + public int? GetGpuPower() { if (_adlContextHandle == nint.Zero || _iGPU == null) return null; From 7f44ba01955985259576651a159280042762cd78 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:00:05 +0200 Subject: [PATCH 2/3] Charge limit UI tweaks --- app/Battery/BatteryControl.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index b15498de..f3a5079d 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -38,8 +38,9 @@ namespace GHelper.Battery if (AppConfig.IsChargeLimit6080()) { - if (limit > 80) limit = 100; + if (limit > 85) limit = 100; else if (limit < 60) limit = 60; + else limit = 80; } Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); From 1ea372556810454195feecf999e07dd74a210656 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:03:53 +0200 Subject: [PATCH 3/3] Screenpad brightness tweak https://github.com/seerge/g-helper/issues/3067 --- app/Input/InputDispatcher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index d1eccca1..8016ef51 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -977,7 +977,7 @@ namespace GHelper.Input } else { - brightness = Math.Max(Math.Min(100, brightness + delta), -10); + brightness = Math.Max(Math.Min(100, brightness + delta), 0); } AppConfig.Set("screenpad", brightness);