Power limits cleanup

This commit is contained in:
Serge
2024-03-02 12:00:37 +01:00
parent 6f49af19ed
commit 2d0defd484

View File

@@ -145,17 +145,16 @@ namespace GHelper.Mode
Program.acpi.SetFanCurve(AsusFan.Mid, AppConfig.GetFanConfig(AsusFan.Mid)); Program.acpi.SetFanCurve(AsusFan.Mid, AppConfig.GetFanConfig(AsusFan.Mid));
// something went wrong, resetting to default profile // Alternative way to set fan curve
if (cpuResult != 1 || gpuResult != 1) if (cpuResult != 1 || gpuResult != 1)
{ {
cpuResult = Program.acpi.SetFanRange(AsusFan.CPU, AppConfig.GetFanConfig(AsusFan.CPU)); cpuResult = Program.acpi.SetFanRange(AsusFan.CPU, AppConfig.GetFanConfig(AsusFan.CPU));
gpuResult = Program.acpi.SetFanRange(AsusFan.GPU, AppConfig.GetFanConfig(AsusFan.GPU)); gpuResult = Program.acpi.SetFanRange(AsusFan.GPU, AppConfig.GetFanConfig(AsusFan.GPU));
// Something went wrong, resetting to default profile
if (cpuResult != 1 || gpuResult != 1) if (cpuResult != 1 || gpuResult != 1)
{ {
int mode = Modes.GetCurrentBase(); Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Modes.GetCurrentBase(), "Reset Mode");
Logger.WriteLine("ASUS BIOS rejected fan curve, resetting mode to " + mode);
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, mode, "Reset Mode");
settings.LabelFansResult("ASUS BIOS rejected fan curve"); settings.LabelFansResult("ASUS BIOS rejected fan curve");
} }
} }
@@ -189,45 +188,22 @@ namespace GHelper.Mode
bool applyPower = AppConfig.IsMode("auto_apply_power"); bool applyPower = AppConfig.IsMode("auto_apply_power");
bool applyFans = AppConfig.IsMode("auto_apply"); bool applyFans = AppConfig.IsMode("auto_apply");
//bool applyGPU = true;
if (applyPower && !applyFans) Task.Run(async () =>
{ {
// force fan curve for misbehaving bios PPTs on some models if (applyPower && !applyFans && (AppConfig.IsFanRequired() || AppConfig.IsManualModeRequired()))
if (AppConfig.IsFanRequired())
{ {
delay = 500; delay = 500;
AutoFans(true); AutoFans(true);
} }
// Fix for models that don't support PPT settings in all modes, setting a "manual" mode for them await Task.Delay(TimeSpan.FromMilliseconds(delay));
if (AppConfig.IsManualModeRequired()) if (applyPower) SetPower(delay == 0);
{
AutoFans(true); await Task.Delay(TimeSpan.FromMilliseconds(500));
}
}
if (delay > 0)
{
var timer = new System.Timers.Timer(delay);
timer.Elapsed += delegate
{
timer.Stop();
timer.Dispose();
if (applyPower) SetPower();
Thread.Sleep(500);
SetGPUPower();
AutoRyzen();
};
timer.Start();
}
else
{
if (applyPower) SetPower(true);
SetGPUPower(); SetGPUPower();
AutoRyzen(); AutoRyzen();
} });
} }