diff --git a/app/Fans.cs b/app/Fans.cs
index aab0ba12..8a0be594 100644
--- a/app/Fans.cs
+++ b/app/Fans.cs
@@ -146,15 +146,23 @@ namespace GHelper
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
+
if (core == -1) core = 0;
- if (memory == 1) memory = 0;
+ if (memory == -1) memory = 0;
- if (readClocks)
+ //if (readClocks)
+ //{
+ int status = nvControl.GetClocks(out int current_core, out int current_memory);
+ if (status != -1)
{
- nvControl.GetClocks(out core, out memory, out string gpuTitle);
- labelGPU.Text = gpuTitle;
+ core = current_core;
+ memory = current_memory;
}
+ labelGPU.Text = nvControl.FullName;
+
+ //}
+
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
diff --git a/app/Gpu/NvidiaGpuControl.cs b/app/Gpu/NvidiaGpuControl.cs
index f45f01f2..50901951 100644
--- a/app/Gpu/NvidiaGpuControl.cs
+++ b/app/Gpu/NvidiaGpuControl.cs
@@ -31,6 +31,8 @@ public class NvidiaGpuControl : IGpuControl
public bool IsNvidia => IsValid;
+ public string FullName => _internalGpu!.FullName;
+
public int? GetCurrentTemperature()
{
if (!IsValid)
@@ -49,12 +51,10 @@ public class NvidiaGpuControl : IGpuControl
}
- public int GetClocks(out int core, out int memory, out string gpu)
+ public int GetClocks(out int core, out int memory)
{
PhysicalGPU internalGpu = _internalGpu!;
- gpu = internalGpu.FullName;
-
//Logger.WriteLine(internalGpu.FullName);
//Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
@@ -63,12 +63,12 @@ public class NvidiaGpuControl : IGpuControl
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
- Logger.WriteLine($"GET GPU Clock offsets : {core}, {memory}");
+ Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}");
return 0;
} catch (Exception ex)
{
- Logger.WriteLine(ex.Message);
+ Logger.WriteLine("GET GPU CLOCKS:" + ex.Message);
core = memory = 0;
return -1;
}
@@ -141,12 +141,12 @@ public class NvidiaGpuControl : IGpuControl
try
{
- Logger.WriteLine($"SET GPU Clock : {core}, {memory}");
+ Logger.WriteLine($"SET GPU CLOCKS: {core}, {memory}");
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
}
catch (Exception ex)
{
- Logger.WriteLine(ex.Message);
+ Logger.WriteLine("SET GPU CLOCKS: "+ex.Message);
return -1;
}
diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs
index b890a276..500aa547 100644
--- a/app/Properties/Strings.Designer.cs
+++ b/app/Properties/Strings.Designer.cs
@@ -825,6 +825,15 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Something is using dGPU and blocking Eco mode. Restart dGPU in device manager and try to set Eco again?.
+ ///
+ internal static string RestartGPU {
+ get {
+ return ResourceManager.GetString("RestartGPU", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to RPM.
///
diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx
index 2a7f8608..d7e53434 100644
--- a/app/Properties/Strings.resx
+++ b/app/Properties/Strings.resx
@@ -372,6 +372,9 @@
Quit
+
+ Something is using dGPU and blocking Eco mode. Restart dGPU in device manager and try to set Eco again?
+
RPM
diff --git a/app/Settings.cs b/app/Settings.cs
index e8fa371a..0a9bccec 100644
--- a/app/Settings.cs
+++ b/app/Settings.cs
@@ -1056,17 +1056,18 @@ namespace GHelper
//if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
+ if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
if (HardwareControl.GpuControl is null) return;
if (!HardwareControl.GpuControl!.IsNvidia) return;
- if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
try
{
- int getStatus = nvControl.GetClocks(out int current_core, out int current_memory, out string gpuName);
- if (getStatus == -1) return;
-
- if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) return;
+ int getStatus = nvControl.GetClocks(out int current_core, out int current_memory);
+ if (getStatus != -1)
+ {
+ if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) return;
+ }
int setStatus = nvControl.SetClocks(gpu_core, gpu_memory);
if (launchAsAdmin && setStatus == -1) Program.RunAsAdmin("gpu");
@@ -1458,7 +1459,7 @@ namespace GHelper
if (HardwareControl.GpuControl is null) return false;
if (!HardwareControl.GpuControl!.IsNvidia) return false;
- DialogResult dialogResult = MessageBox.Show("Something is using dGPU and blocking Eco mode. Restart dGPU in a device manager and try to set Eco again?", Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
+ DialogResult dialogResult = MessageBox.Show(Properties.Strings.RestartGPU, Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No) return false;
Program.RunAsAdmin();