mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Max fan RPM auto calibration
This commit is contained in:
@@ -108,6 +108,8 @@ public class AppConfig
|
||||
|
||||
if (device == 1)
|
||||
name = "gpu";
|
||||
else if (device == 2)
|
||||
name = "mid";
|
||||
else
|
||||
name = "cpu";
|
||||
|
||||
|
||||
12
app/Fans.cs
12
app/Fans.cs
@@ -18,7 +18,7 @@ namespace GHelper
|
||||
{
|
||||
if (percentage == 0) return "OFF";
|
||||
|
||||
return (200 * Math.Round((float)(MinRPM + (MaxRPM - MinRPM) * percentage * 0.01) / 200)).ToString() + unit;
|
||||
return (200 * Math.Round((float)(MinRPM*100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
@@ -89,14 +89,8 @@ namespace GHelper
|
||||
InitializeComponent();
|
||||
InitTheme();
|
||||
|
||||
MinRPM = 1800;
|
||||
|
||||
if (Program.config.ContainsModel("401"))
|
||||
MaxRPM = 7200;
|
||||
else if (Program.config.ContainsModel("503"))
|
||||
MaxRPM = 6800;
|
||||
else
|
||||
MaxRPM = 5800;
|
||||
MinRPM = 18;
|
||||
MaxRPM = HardwareMonitor.GetFanMax();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,19 @@ public static class HardwareMonitor
|
||||
public static string? gpuFan;
|
||||
public static string? midFan;
|
||||
|
||||
public static int GetFanMax()
|
||||
{
|
||||
int max = 58;
|
||||
if (Program.config.ContainsModel("401")) max = 72;
|
||||
else if (Program.config.ContainsModel("503")) max = 68;
|
||||
|
||||
return Math.Max(max, Program.config.getConfig("fan_max"));
|
||||
}
|
||||
|
||||
public static void SetFanMax(int fan)
|
||||
{
|
||||
Program.config.setConfig("fan_max", fan);
|
||||
}
|
||||
private static string FormatFan(int fan)
|
||||
{
|
||||
// fix for old models
|
||||
@@ -23,10 +36,13 @@ public static class HardwareMonitor
|
||||
if (fan <= 0 || fan > 100) return null; //nothing reasonable
|
||||
}
|
||||
|
||||
int fanMax = GetFanMax();
|
||||
if (fan > fanMax) SetFanMax(fan);
|
||||
|
||||
if (Program.config.getConfig("fan_rpm") == 1)
|
||||
return " Fan: " + (fan * 100).ToString() + "RPM";
|
||||
else
|
||||
return " Fan: " + Math.Min(Math.Round(fan / 0.6), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
return " Fan: " + Math.Min(Math.Round((float)fan/fanMax*100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
}
|
||||
|
||||
public static void ReadSensors()
|
||||
|
||||
Reference in New Issue
Block a user