This commit is contained in:
Serge
2024-09-07 15:04:14 +02:00
4 changed files with 19 additions and 4 deletions

View File

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

View File

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

View File

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

View File

@@ -978,7 +978,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);