mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
1 Commits
Experiment
...
FixedCurve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04afbea26f |
@@ -583,7 +583,7 @@ public class AsusACPI
|
||||
}
|
||||
|
||||
//Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
|
||||
|
||||
if (IsInvalidCurve(result)) result = AppConfig.GetDefaultCurve(device);
|
||||
return result;
|
||||
|
||||
}
|
||||
@@ -598,43 +598,20 @@ public class AsusACPI
|
||||
return curve.All(singleByte => singleByte == 0);
|
||||
}
|
||||
|
||||
public static int FixTemp(int temp, int index)
|
||||
{
|
||||
var dxMin = 30 + 10 * index;
|
||||
var dxMax = dxMin + 9;
|
||||
return Math.Min(dxMax, Math.Max(dxMin, temp));
|
||||
}
|
||||
|
||||
public static byte[] FixFanCurve(byte[] curve)
|
||||
{
|
||||
if (curve.Length != 16) throw new Exception("Incorrect curve");
|
||||
|
||||
var points = new Dictionary<byte, byte>();
|
||||
byte old = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (curve[i] <= old) curve[i] = (byte)Math.Min(100, old + 6); // preventing 2 points in same spot from default asus profiles
|
||||
points[curve[i]] = curve[i + 8];
|
||||
old = curve[i];
|
||||
}
|
||||
|
||||
var pointsFixed = new Dictionary<byte, byte>();
|
||||
bool fix = false;
|
||||
|
||||
int count = 0;
|
||||
foreach (var pair in points.OrderBy(x => x.Key))
|
||||
{
|
||||
if (count == 0 && pair.Key >= 40)
|
||||
{
|
||||
fix = true;
|
||||
pointsFixed.Add(30, 0);
|
||||
}
|
||||
|
||||
if (count != 3 || !fix)
|
||||
pointsFixed.Add(pair.Key, pair.Value);
|
||||
count++;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
foreach (var pair in pointsFixed.OrderBy(x => x.Key))
|
||||
{
|
||||
curve[count] = pair.Key;
|
||||
curve[count + 8] = pair.Value;
|
||||
count++;
|
||||
curve[i] = (byte)FixTemp(curve[i], i);
|
||||
}
|
||||
|
||||
return curve;
|
||||
|
||||
18
app/Fans.cs
18
app/Fans.cs
@@ -757,8 +757,8 @@ namespace GHelper
|
||||
|
||||
chart.Titles[0].Text = title;
|
||||
|
||||
chart.ChartAreas[0].AxisX.Minimum = 10;
|
||||
chart.ChartAreas[0].AxisX.Maximum = 100;
|
||||
chart.ChartAreas[0].AxisX.Minimum = 20;
|
||||
chart.ChartAreas[0].AxisX.Maximum = 110;
|
||||
chart.ChartAreas[0].AxisX.Interval = 10;
|
||||
|
||||
chart.ChartAreas[0].AxisY.Minimum = 0;
|
||||
@@ -1019,7 +1019,7 @@ namespace GHelper
|
||||
int chartCount = 2;
|
||||
|
||||
// Middle / system fan check
|
||||
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)) || Program.acpi.GetFan(AsusFan.Mid) >= 0)
|
||||
if (Program.acpi.GetFan(AsusFan.Mid) >= 0)
|
||||
{
|
||||
AppConfig.Set("mid_fan", 1);
|
||||
chartCount++;
|
||||
@@ -1082,15 +1082,10 @@ namespace GHelper
|
||||
if (reset || AsusACPI.IsInvalidCurve(curve))
|
||||
{
|
||||
curve = Program.acpi.GetFanCurve(device, Modes.GetCurrentBase());
|
||||
|
||||
if (AsusACPI.IsInvalidCurve(curve))
|
||||
curve = AppConfig.GetDefaultCurve(device);
|
||||
|
||||
curve = AsusACPI.FixFanCurve(curve);
|
||||
|
||||
Logger.WriteLine($"Default {device}:" + BitConverter.ToString(curve));
|
||||
}
|
||||
|
||||
//Debug.WriteLine(BitConverter.ToString(curve));
|
||||
curve = AsusACPI.FixFanCurve(curve);
|
||||
|
||||
byte old = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
@@ -1245,8 +1240,7 @@ namespace GHelper
|
||||
dx = ax.PixelPositionToValue(e.X);
|
||||
dy = ay.PixelPositionToValue(e.Y);
|
||||
|
||||
if (dx < 20) dx = 20;
|
||||
if (dx > 100) dx = 100;
|
||||
dx = AsusACPI.FixTemp((int)dx, curIndex);
|
||||
|
||||
if (dy < 0) dy = 0;
|
||||
if (dy > fansMax) dy = fansMax;
|
||||
|
||||
Reference in New Issue
Block a user