Skip to content

Commit

Permalink
PowerControl: Improve handling of ? settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Jan 12, 2023
1 parent 02d68af commit d1546d1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion PowerControl/Menu/MenuItemWithOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ private void FinalizeSet()

if (ApplyValue != null && SelectedOption != null)
{
ActiveOption = ApplyValue(SelectedOption);
try
{
ActiveOption = ApplyValue(SelectedOption);
}
catch (Exception e)
{
CommonHelpers.Log.TraceException("FinalizeSet", Name, e);
Update();
}

if (AfterApply != null && runAfterApply)
AfterApply();
Expand Down
1 change: 1 addition & 0 deletions PowerControl/Options/CPUFrequency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static class CPUFrequency

switch (selected.ToString())
{
case "?":
case "Default":
sd.MinCPUClock = 1400;
sd.MaxCPUClock = 3500;
Expand Down
5 changes: 4 additions & 1 deletion PowerControl/Options/GPUFrequency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ public static class GPUFrequency
"Leave the game if it uses anti-cheat protection."))
return null;

if (selected == "?")
selected = "Default";

return CommonHelpers.Instance.WithGlobalMutex<string>(200, () =>
{
using (var sd = VangoghGPU.Open())
{
if (sd is null)
return null;

if (selected == "Default")
if (selected == "Default" || selected == "?")
{
sd.HardMinGfxClock = 200;
return selected;
Expand Down
4 changes: 4 additions & 0 deletions PowerControl/Options/TDP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public static class TDP
"Leave the game if it uses anti-cheat protection."))
return null;

// If undefined, select max
if (selected == "?")
selected = "15W";

uint mW = uint.Parse(selected.Replace("W", "")) * 1000;

if (VangoghGPU.IsSupported)
Expand Down

0 comments on commit d1546d1

Please sign in to comment.