Skip to content

Commit

Permalink
Merge branch 'seerge:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
HamzaYslmn authored Apr 9, 2023
2 parents eb990db + e82dab5 commit 7578164
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
20 changes: 17 additions & 3 deletions app/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Management;
using System.Diagnostics;
using System.Management;
using System.Text.Json;

public class AppConfig
Expand Down Expand Up @@ -91,14 +92,27 @@ public void setConfig(string name, int value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
try
{
File.WriteAllText(configFile, jsonString);
} catch (Exception e)
{
Debug.Write(e.ToString());
}
}

public void setConfig(string name, string value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
try
{
File.WriteAllText(configFile, jsonString);
}
catch (Exception e)
{
Debug.Write(e.ToString());
}
}

public string getParamName(int device, string paramName = "fan_profile")
Expand Down
14 changes: 13 additions & 1 deletion app/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -907,13 +907,25 @@ public void AutoFans()
if (Program.config.getConfig("mid_fan") == 1)
Program.wmi.SetFanCurve(2, Program.config.getFanConfig(2));

if (cpuResult != 1 || gpuResult != 1) // something went wrong, resetting to default profile
// something went wrong, resetting to default profile
if (cpuResult != 1 || gpuResult != 1)
{
int mode = Program.config.getConfig("performance_mode");
Logger.WriteLine("Driver rejected fan curve, resetting mode to " + mode);
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, mode, "PerformanceMode");
}
else customFans = true;

// fix for misbehaving bios on intell based TUF 2022
if (Program.config.ContainsModel("FX507") && Program.config.getConfigPerf("auto_apply_power") != 1)
{
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(1));
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, 80, "PowerLimit Fix");
});
}

}

Program.settingsForm.BeginInvoke(SetPerformanceLabel);
Expand Down

0 comments on commit 7578164

Please sign in to comment.