Clocks fixes

This commit is contained in:
Serge
2023-05-09 18:02:59 +02:00
parent 56ea434626
commit c69bf65c84
4 changed files with 39 additions and 22 deletions

View File

@@ -92,7 +92,7 @@ public static class ControlHelper
}
var chk = control as CheckBox;
if (chk != null && chk.Padding.Left > 5)
if (chk != null && chk.Padding.Right > 5)
{
chk.BackColor = RForm.buttonSecond;
}

View File

@@ -119,7 +119,8 @@ namespace GHelper
private void TrackGPU_MouseUp(object? sender, MouseEventArgs e)
{
Program.settingsForm.SetGPUSettings(true);
Program.settingsForm.SetGPUPower();
Program.settingsForm.SetGPUClocks(true);
}
public void InitGPU(bool readClocks = false)
@@ -509,7 +510,14 @@ namespace GHelper
trackGPUBoost.Value = ASUSWmi.MaxGPUBoost;
trackGPUTemp.Value = ASUSWmi.MaxGPUTemp;
Program.settingsForm.SetGPUSettings(true);
Program.config.setConfigPerf("gpu_boost", trackGPUBoost.Value);
Program.config.setConfigPerf("gpu_temp", trackGPUTemp.Value);
Program.config.setConfigPerf("gpu_core", trackGPUCore.Value);
Program.config.setConfigPerf("gpu_memory", trackGPUMemory.Value);
VisualiseGPUSettings();
Program.settingsForm.SetGPUClocks(true);
Program.settingsForm.SetGPUPower();
}
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)

View File

@@ -95,8 +95,8 @@ public class NvidiaGpuControl : IGpuControl
try
{
Logger.WriteLine($"SET GPU Clock : {core}, {memory}");
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
Logger.WriteLine($"SET GPU Clock offsets : {core}, {memory}");
}
catch (Exception ex)
{

View File

@@ -1045,27 +1045,14 @@ namespace GHelper
}
public void SetGPUSettings(bool launchAsAdmin = true)
{
int gpu_boost = Program.config.getConfigPerf("gpu_boost");
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
public void SetGPUClocks(bool launchAsAdmin = true)
{
int gpu_core = Program.config.getConfigPerf("gpu_core");
int gpu_memory = Program.config.getConfigPerf("gpu_memory");
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost ) return;
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC0, gpu_boost, "PowerLimit C0");
}
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC2) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC2, gpu_temp, "PowerLimit C2");
}
if (gpu_core == -1 && gpu_memory == -1) return;
if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
@@ -1082,7 +1069,27 @@ namespace GHelper
Logger.WriteLine(ex.ToString());
}
}
}
public void SetGPUPower()
{
int gpu_boost = Program.config.getConfigPerf("gpu_boost");
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost ) return;
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC0, gpu_boost, "PowerLimit C0");
}
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC2) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC2, gpu_temp, "PowerLimit C2");
}
}
@@ -1159,14 +1166,14 @@ namespace GHelper
timer.Stop();
timer.Dispose();
if (applyPower) SetPower();
SetGPUSettings();
SetGPUPower();
};
timer.Start();
}
else
{
if (applyPower) SetPower();
SetGPUSettings();
SetGPUPower();
}
}
@@ -1221,6 +1228,8 @@ namespace GHelper
}
}
SetGPUClocks();
AutoFans();
AutoPower(1000);