Use watts as double to have more fine grained control

This commit is contained in:
IceStormNG
2024-03-01 18:55:50 +01:00
parent 2aebf3044d
commit 8cd256463a
4 changed files with 7 additions and 7 deletions

View File

@@ -379,7 +379,7 @@ namespace GHelper.AutoTDP
Logger.WriteLine("[AutoTDPService] Setting Power Limit from " + CurrentTDP + "W to " + newPL + "W, Delta:" + adjustment); Logger.WriteLine("[AutoTDPService] Setting Power Limit from " + CurrentTDP + "W to " + newPL + "W, Delta:" + adjustment);
//We only limit to full watts, no fractions. In this case, we will cut off the fractional part //We only limit to full watts, no fractions. In this case, we will cut off the fractional part
powerLimiter.SetCPUPowerLimit((int)newPL); powerLimiter.SetCPUPowerLimit(newPL);
CurrentTDP = newPL; CurrentTDP = newPL;
} }

View File

@@ -21,17 +21,17 @@ namespace GHelper.AutoTDP.PowerLimiter
} }
} }
public void SetCPUPowerLimit(int watts) public void SetCPUPowerLimit(double watts)
{ {
if (Program.acpi.DeviceGet(AsusACPI.PPT_APUA0) >= 0) if (Program.acpi.DeviceGet(AsusACPI.PPT_APUA0) >= 0)
{ {
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, watts, "PowerLimit A3"); Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, (int)watts, "PowerLimit A3");
Program.acpi.DeviceSet(AsusACPI.PPT_APUA0, watts, "PowerLimit A0"); Program.acpi.DeviceSet(AsusACPI.PPT_APUA0, (int)watts, "PowerLimit A0");
} }
if (Program.acpi.IsAllAmdPPT()) // CPU limit all amd models if (Program.acpi.IsAllAmdPPT()) // CPU limit all amd models
{ {
Program.acpi.DeviceSet(AsusACPI.PPT_CPUB0, watts, "PowerLimit B0"); Program.acpi.DeviceSet(AsusACPI.PPT_CPUB0, (int)watts, "PowerLimit B0");
} }
} }

View File

@@ -2,7 +2,7 @@
{ {
internal interface IPowerLimiter : IDisposable internal interface IPowerLimiter : IDisposable
{ {
public void SetCPUPowerLimit(int watts); public void SetCPUPowerLimit(double watts);
public int GetCPUPowerLimit(); public int GetCPUPowerLimit();

View File

@@ -36,7 +36,7 @@ namespace GHelper.AutoTDP.PowerLimiter
PowerUnit = 1 / Math.Pow(2, pwr); PowerUnit = 1 / Math.Pow(2, pwr);
} }
public void SetCPUPowerLimit(int watts) public void SetCPUPowerLimit(double watts)
{ {
uint eax = 0; uint eax = 0;
uint edx = 0; uint edx = 0;