mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Re-apply ryzen power limits for old models https://github.com/seerge/g-helper/issues/2355
This commit is contained in:
@@ -15,6 +15,7 @@ namespace GHelper.Mode
|
|||||||
|
|
||||||
private int _cpuUV = 0;
|
private int _cpuUV = 0;
|
||||||
private int _igpuUV = 0;
|
private int _igpuUV = 0;
|
||||||
|
private bool _ryzenPower = false;
|
||||||
|
|
||||||
static System.Timers.Timer reapplyTimer = default!;
|
static System.Timers.Timer reapplyTimer = default!;
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ namespace GHelper.Mode
|
|||||||
private void ReapplyTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
private void ReapplyTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
SetCPUTemp(AppConfig.GetMode("cpu_temp"), false);
|
SetCPUTemp(AppConfig.GetMode("cpu_temp"), false);
|
||||||
|
if (_ryzenPower) SetRyzenPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AutoPerformance(bool powerChanged = false)
|
public void AutoPerformance(bool powerChanged = false)
|
||||||
@@ -222,6 +224,31 @@ namespace GHelper.Mode
|
|||||||
settings.SetModeLabel(Properties.Strings.PerformanceMode + ": " + Modes.GetCurrentName() + (customFans ? "+" : "") + ((customPower > 0) ? " " + customPower + "W" : ""));
|
settings.SetModeLabel(Properties.Strings.PerformanceMode + ": " + Modes.GetCurrentName() + (customFans ? "+" : "") + ((customPower > 0) ? " " + customPower + "W" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetRyzenPower(bool log = false)
|
||||||
|
{
|
||||||
|
if (!AppConfig.IsMode("auto_apply_power")) return;
|
||||||
|
|
||||||
|
int limit_total = AppConfig.GetMode("limit_total");
|
||||||
|
int limit_slow = AppConfig.GetMode("limit_slow", limit_total);
|
||||||
|
|
||||||
|
if (limit_total > AsusACPI.MaxTotal) return;
|
||||||
|
if (limit_total < AsusACPI.MinTotal) return;
|
||||||
|
|
||||||
|
var stapmResult = SendCommand.set_stapm_limit((uint)limit_total * 1000);
|
||||||
|
if (log) Logger.WriteLine($"STAPM: {limit_total} {stapmResult}");
|
||||||
|
|
||||||
|
var stapmResult2 = SendCommand.set_stapm2_limit((uint)limit_total * 1000);
|
||||||
|
if (log) Logger.WriteLine($"STAPM2: {limit_total} {stapmResult2}");
|
||||||
|
|
||||||
|
var slowResult = SendCommand.set_slow_limit((uint)limit_slow * 1000);
|
||||||
|
if (log) Logger.WriteLine($"SLOW: {limit_slow} {slowResult}");
|
||||||
|
|
||||||
|
var fastResult = SendCommand.set_fast_limit((uint)limit_slow * 1000);
|
||||||
|
if (log) Logger.WriteLine($"FAST: {limit_slow} {fastResult}");
|
||||||
|
|
||||||
|
_ryzenPower = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPower(bool launchAsAdmin = false)
|
public void SetPower(bool launchAsAdmin = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -258,18 +285,7 @@ namespace GHelper.Mode
|
|||||||
|
|
||||||
if (ProcessHelper.IsUserAdministrator())
|
if (ProcessHelper.IsUserAdministrator())
|
||||||
{
|
{
|
||||||
var stapmResult = SendCommand.set_stapm_limit((uint)limit_total * 1000);
|
SetRyzenPower(true);
|
||||||
Logger.WriteLine($"STAPM: {limit_total} {stapmResult}");
|
|
||||||
|
|
||||||
var stapmResult2 = SendCommand.set_stapm2_limit((uint)limit_total * 1000);
|
|
||||||
Logger.WriteLine($"STAPM2: {limit_total} {stapmResult2}");
|
|
||||||
|
|
||||||
var slowResult = SendCommand.set_slow_limit((uint)limit_slow * 1000);
|
|
||||||
Logger.WriteLine($"SLOW: {limit_slow} {slowResult}");
|
|
||||||
|
|
||||||
var fastResult = SendCommand.set_fast_limit((uint)limit_slow * 1000);
|
|
||||||
Logger.WriteLine($"FAST: {limit_slow} {fastResult}");
|
|
||||||
|
|
||||||
customPower = limit_total;
|
customPower = limit_total;
|
||||||
}
|
}
|
||||||
else if (launchAsAdmin)
|
else if (launchAsAdmin)
|
||||||
|
|||||||
Reference in New Issue
Block a user