Skip to content

Commit

Permalink
Custom CPU temp limit reset for a manual setting #3504
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Dec 21, 2024
1 parent 1f2d186 commit 1a94ed0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/Mode/ModeControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ModeControl

private static bool customFans = false;
private static int customPower = 0;
private static bool customTemp = false;

private int _cpuUV = 0;
private int _igpuUV = 0;
Expand Down Expand Up @@ -82,6 +83,8 @@ public void SetPerformanceMode(int mode = -1, bool notify = false)

customFans = false;
customPower = 0;
customTemp = false;

SetModeLabel();

// Workaround for not properly resetting limits on G14 2024
Expand Down Expand Up @@ -394,10 +397,17 @@ public void SetGPUPower()

public void SetCPUTemp(int? cpuTemp, bool init = false)
{
if (cpuTemp == RyzenControl.MaxTemp && customTemp)
{
cpuTemp = RyzenControl.DefaultTemp;
Logger.WriteLine($"Custom CPU Temp reset");
}

if (cpuTemp >= RyzenControl.MinTemp && cpuTemp < RyzenControl.MaxTemp)
{
var resultCPU = SendCommand.set_tctl_temp((uint)cpuTemp);
if (init) Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}");
if (resultCPU == Smu.Status.OK) customTemp = cpuTemp != RyzenControl.DefaultTemp;
}
}

Expand Down
1 change: 1 addition & 0 deletions app/Ryzen/RyzenControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal class RyzenControl

public static int MinTemp => AppConfig.Get("min_temp", 75);
public const int MaxTemp = 98;
public const int DefaultTemp = 96;

public static int FAMID { get; protected set; }

Expand Down

0 comments on commit 1a94ed0

Please sign in to comment.