mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Re-apply temp-limit
This commit is contained in:
@@ -4,7 +4,6 @@ namespace GHelper.Display
|
||||
{
|
||||
public class ScreenControl
|
||||
{
|
||||
static SettingsForm settings = Program.settingsForm;
|
||||
public void AutoScreen(bool force = false)
|
||||
{
|
||||
if (force || AppConfig.Is("screen_auto"))
|
||||
@@ -82,9 +81,9 @@ namespace GHelper.Display
|
||||
AppConfig.Set("frequency", frequency);
|
||||
AppConfig.Set("overdrive", overdrive);
|
||||
|
||||
settings.Invoke(delegate
|
||||
Program.settingsForm.Invoke(delegate
|
||||
{
|
||||
settings.VisualiseScreen(
|
||||
Program.settingsForm.VisualiseScreen(
|
||||
screenEnabled: screenEnabled,
|
||||
screenAuto: screenAuto,
|
||||
frequency: frequency,
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace GHelper
|
||||
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
|
||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||
{
|
||||
{"","--------------" },
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace GHelper
|
||||
{
|
||||
|
||||
int curIndex = -1;
|
||||
DataPoint curPoint = null;
|
||||
DataPoint? curPoint = null;
|
||||
|
||||
Series seriesCPU;
|
||||
Series seriesGPU;
|
||||
@@ -25,7 +25,7 @@ namespace GHelper
|
||||
const int fansMax = 100;
|
||||
|
||||
NvidiaGpuControl? nvControl = null;
|
||||
ModeControl modeControl = new ModeControl();
|
||||
ModeControl modeControl = Program.modeControl;
|
||||
|
||||
public Fans()
|
||||
{
|
||||
@@ -183,6 +183,7 @@ namespace GHelper
|
||||
private void CheckApplyUV_Click(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.SetMode("auto_uv", checkApplyUV.Checked ? 1 : 0);
|
||||
modeControl.AutoUV();
|
||||
}
|
||||
|
||||
public void InitAll()
|
||||
@@ -974,8 +975,8 @@ namespace GHelper
|
||||
{
|
||||
|
||||
// Get the neighboring DataPoints of the hit point
|
||||
DataPoint upperPoint = null;
|
||||
DataPoint lowerPoint = null;
|
||||
DataPoint? upperPoint = null;
|
||||
DataPoint? lowerPoint = null;
|
||||
|
||||
if (index > 0)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using GHelper.Display;
|
||||
using GHelper.Gpu.NVidia;
|
||||
using GHelper.Helpers;
|
||||
using GHelper.Mode;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GHelper.Gpu
|
||||
@@ -9,7 +8,6 @@ namespace GHelper.Gpu
|
||||
public class GPUModeControl
|
||||
{
|
||||
static SettingsForm settings = Program.settingsForm;
|
||||
ModeControl modeControl = new ModeControl();
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
public void InitGPUMode()
|
||||
@@ -153,7 +151,7 @@ namespace GHelper.Gpu
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(3000));
|
||||
HardwareControl.RecreateGpuControl();
|
||||
modeControl.SetGPUClocks(false);
|
||||
Program.modeControl.SetGPUClocks(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace GHelper.Input
|
||||
public static Keys keyProfile = Keys.F5;
|
||||
public static Keys keyApp = Keys.F12;
|
||||
|
||||
static ModeControl modeControl = new ModeControl();
|
||||
static ModeControl modeControl = Program.modeControl;
|
||||
static ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
KeyboardListener listener;
|
||||
|
||||
@@ -12,6 +12,20 @@ namespace GHelper.Mode
|
||||
private static bool customFans = false;
|
||||
private static int customPower = 0;
|
||||
|
||||
static System.Timers.Timer reapplyTimer = default!;
|
||||
|
||||
public ModeControl()
|
||||
{
|
||||
reapplyTimer = new System.Timers.Timer(5000);
|
||||
reapplyTimer.Elapsed += ReapplyTimer_Elapsed;
|
||||
reapplyTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private void ReapplyTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
SetCPUTemp(AppConfig.GetMode("cpu_temp"), false);
|
||||
}
|
||||
|
||||
public void AutoPerformance(bool powerChanged = false)
|
||||
{
|
||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||
@@ -141,7 +155,6 @@ namespace GHelper.Mode
|
||||
AppConfig.Is("manual_mode") ||
|
||||
AppConfig.ContainsModel("GU603") ||
|
||||
AppConfig.ContainsModel("GU604") ||
|
||||
AppConfig.ContainsModel("FX517") ||
|
||||
AppConfig.ContainsModel("G733");
|
||||
}
|
||||
|
||||
@@ -313,6 +326,24 @@ namespace GHelper.Mode
|
||||
SetUV();
|
||||
}
|
||||
|
||||
public void SetCPUTemp(int? cpuTemp, bool log = true)
|
||||
{
|
||||
if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp)
|
||||
{
|
||||
var resultCPU = SendCommand.set_tctl_temp((uint)cpuTemp);
|
||||
if (log) Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}");
|
||||
|
||||
var restultAPU = SendCommand.set_apu_skin_temp_limit((uint)cpuTemp);
|
||||
if (log) Logger.WriteLine($"APU Temp: {cpuTemp} {restultAPU}");
|
||||
|
||||
reapplyTimer.Enabled = AppConfig.IsMode("auto_uv");
|
||||
|
||||
} else
|
||||
{
|
||||
reapplyTimer.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetUV(bool launchAsAdmin = false)
|
||||
{
|
||||
|
||||
@@ -332,19 +363,17 @@ namespace GHelper.Mode
|
||||
{
|
||||
if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV)
|
||||
{
|
||||
SendCommand.set_coall(cpuUV);
|
||||
var uvResult = SendCommand.set_coall(cpuUV);
|
||||
Logger.WriteLine($"UV: {cpuUV} {uvResult}");
|
||||
}
|
||||
|
||||
if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV)
|
||||
{
|
||||
SendCommand.set_cogfx(igpuUV);
|
||||
var iGPUResult = SendCommand.set_cogfx(igpuUV);
|
||||
Logger.WriteLine($"iGPU UV: {igpuUV} {iGPUResult}");
|
||||
}
|
||||
|
||||
if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp)
|
||||
{
|
||||
SendCommand.set_tctl_temp((uint)cpuTemp);
|
||||
SendCommand.set_apu_skin_temp_limit((uint)cpuTemp);
|
||||
}
|
||||
SetCPUTemp(cpuTemp);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -22,12 +22,13 @@ namespace GHelper
|
||||
Visible = true
|
||||
};
|
||||
|
||||
public static AsusACPI? acpi;
|
||||
public static AsusACPI acpi;
|
||||
|
||||
public static SettingsForm settingsForm = new SettingsForm();
|
||||
|
||||
public static ModeControl modeControl = new ModeControl();
|
||||
public static GPUModeControl gpuControl = new GPUModeControl();
|
||||
public static ScreenControl screenControl = new ScreenControl();
|
||||
static GPUModeControl gpuControl = new GPUModeControl();
|
||||
static ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
public static ToastForm toast = new ToastForm();
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Ryzen
|
||||
}
|
||||
|
||||
//TCTL Temp Limit
|
||||
public static void set_tctl_temp(uint value)
|
||||
public static Smu.Status? set_tctl_temp(uint value)
|
||||
{
|
||||
RyzenAccess.Initialize();
|
||||
uint[] Args = new uint[6];
|
||||
@@ -227,9 +227,8 @@ namespace Ryzen
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.WriteLine($"CPU Temp: {value} {result}");
|
||||
|
||||
RyzenAccess.Deinitialize();
|
||||
return result;
|
||||
}
|
||||
|
||||
//cHTC Temp Limit
|
||||
@@ -261,7 +260,7 @@ namespace Ryzen
|
||||
}
|
||||
|
||||
//Skin Temp limit
|
||||
public static void set_apu_skin_temp_limit(uint value)
|
||||
public static Smu.Status? set_apu_skin_temp_limit(uint value)
|
||||
{
|
||||
RyzenAccess.Initialize();
|
||||
uint[] Args = new uint[6];
|
||||
@@ -285,9 +284,9 @@ namespace Ryzen
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.WriteLine($"APU Temp: {value} {result}");
|
||||
|
||||
RyzenAccess.Deinitialize();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//VRM Current
|
||||
@@ -908,7 +907,7 @@ namespace Ryzen
|
||||
}
|
||||
|
||||
//Set All Core Curve Optimiser
|
||||
public static void set_coall(int value)
|
||||
public static Smu.Status? set_coall(int value)
|
||||
{
|
||||
|
||||
uint uvalue = Convert.ToUInt32(0x100000 - (uint)(-1 * value));
|
||||
@@ -944,9 +943,9 @@ namespace Ryzen
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.WriteLine($"UV: {value} {result}");
|
||||
|
||||
RyzenAccess.Deinitialize();
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//Set Per Core Curve Optimiser
|
||||
@@ -982,7 +981,7 @@ namespace Ryzen
|
||||
}
|
||||
|
||||
//Set iGPU Curve Optimiser
|
||||
public static void set_cogfx(int value)
|
||||
public static Smu.Status? set_cogfx(int value)
|
||||
{
|
||||
|
||||
uint uvalue = Convert.ToUInt32(0x100000 - (uint)(-1 * value));
|
||||
@@ -1010,9 +1009,8 @@ namespace Ryzen
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.WriteLine($"iGPU UV: {value} {result}");
|
||||
|
||||
RyzenAccess.Deinitialize();
|
||||
return result;
|
||||
}
|
||||
|
||||
//Disable OC
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace GHelper
|
||||
ContextMenuStrip contextMenuStrip = new CustomContextMenu();
|
||||
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
|
||||
|
||||
ModeControl modeControl = new ModeControl();
|
||||
GPUModeControl gpuControl = new GPUModeControl();
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
@@ -39,7 +38,7 @@ namespace GHelper
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
InitTheme(true);
|
||||
|
||||
@@ -183,10 +182,8 @@ namespace GHelper
|
||||
|
||||
SetContextMenu();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
|
||||
{
|
||||
aTimer.Enabled = this.Visible;
|
||||
@@ -1125,17 +1122,17 @@ namespace GHelper
|
||||
|
||||
private void ButtonSilent_Click(object? sender, EventArgs e)
|
||||
{
|
||||
modeControl.SetPerformanceMode(AsusACPI.PerformanceSilent);
|
||||
Program.modeControl.SetPerformanceMode(AsusACPI.PerformanceSilent);
|
||||
}
|
||||
|
||||
private void ButtonBalanced_Click(object? sender, EventArgs e)
|
||||
{
|
||||
modeControl.SetPerformanceMode(AsusACPI.PerformanceBalanced);
|
||||
Program.modeControl.SetPerformanceMode(AsusACPI.PerformanceBalanced);
|
||||
}
|
||||
|
||||
private void ButtonTurbo_Click(object? sender, EventArgs e)
|
||||
{
|
||||
modeControl.SetPerformanceMode(AsusACPI.PerformanceTurbo);
|
||||
Program.modeControl.SetPerformanceMode(AsusACPI.PerformanceTurbo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user