From e82dab5e7cece72a6fe0938c2b8d30177d0037d0 Mon Sep 17 00:00:00 2001 From: seerge Date: Sun, 9 Apr 2023 15:24:09 +0200 Subject: [PATCH] Fix for FX507 models --- app/AppConfig.cs | 20 +++++++++++++++++--- app/Settings.cs | 14 +++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 463f68fcc..05264acdd 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -1,4 +1,5 @@ -using System.Management; +using System.Diagnostics; +using System.Management; using System.Text.Json; public class AppConfig @@ -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") diff --git a/app/Settings.cs b/app/Settings.cs index 4cb915623..4241a3782 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -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);