mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
1 Commits
v0.196
...
FixedCurve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04afbea26f |
@@ -696,7 +696,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsForceMiniled()
|
public static bool IsForceMiniled()
|
||||||
{
|
{
|
||||||
return ContainsModel("G834JYR") || ContainsModel("G834JZR") || Is("force_miniled");
|
return ContainsModel("G834JYR") || Is("force_miniled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SaveDimming()
|
public static bool SaveDimming()
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ public class AsusACPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
|
//Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
|
||||||
|
if (IsInvalidCurve(result)) result = AppConfig.GetDefaultCurve(device);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -598,43 +598,20 @@ public class AsusACPI
|
|||||||
return curve.All(singleByte => singleByte == 0);
|
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)
|
public static byte[] FixFanCurve(byte[] curve)
|
||||||
{
|
{
|
||||||
if (curve.Length != 16) throw new Exception("Incorrect 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++)
|
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
|
curve[i] = (byte)FixTemp(curve[i], i);
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return curve;
|
return curve;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using GHelper.Helpers;
|
using GHelper.Helpers;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System.Management;
|
using System.Management;
|
||||||
|
|
||||||
namespace GHelper.Display
|
namespace GHelper.Display
|
||||||
@@ -38,7 +37,6 @@ namespace GHelper.Display
|
|||||||
Cinema = 25,
|
Cinema = 25,
|
||||||
Vivid = 13,
|
Vivid = 13,
|
||||||
Eyecare = 17,
|
Eyecare = 17,
|
||||||
Disabled = 18,
|
|
||||||
}
|
}
|
||||||
public static class VisualControl
|
public static class VisualControl
|
||||||
{
|
{
|
||||||
@@ -177,8 +175,7 @@ namespace GHelper.Display
|
|||||||
{ SplendidCommand.FPS, "FPS"},
|
{ SplendidCommand.FPS, "FPS"},
|
||||||
{ SplendidCommand.Cinema, "Cinema"},
|
{ SplendidCommand.Cinema, "Cinema"},
|
||||||
{ SplendidCommand.Vivid, "Vivid" },
|
{ SplendidCommand.Vivid, "Vivid" },
|
||||||
{ SplendidCommand.Eyecare, "Eyecare"},
|
{ SplendidCommand.Eyecare, "Eyecare"}
|
||||||
{ SplendidCommand.Disabled, "Disabled"}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,20 +205,6 @@ namespace GHelper.Display
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const string GameVisualKey = @"HKEY_CURRENT_USER\Software\ASUS\ARMOURY CRATE Service\GameVisual";
|
|
||||||
const string GameVisualValue = "ActiveGVStatus";
|
|
||||||
|
|
||||||
public static bool IsEnabled()
|
|
||||||
{
|
|
||||||
var status = (int?)Registry.GetValue(GameVisualKey, GameVisualValue, 1);
|
|
||||||
return status > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetRegStatus(int status = 1)
|
|
||||||
{
|
|
||||||
Registry.SetValue(GameVisualKey, GameVisualValue, status, RegistryValueKind.DWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetGamut(int mode = -1)
|
public static void SetGamut(int mode = -1)
|
||||||
{
|
{
|
||||||
if (skipGamut) return;
|
if (skipGamut) return;
|
||||||
@@ -252,7 +235,7 @@ namespace GHelper.Display
|
|||||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
|
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
|
||||||
{
|
{
|
||||||
if (mode == SplendidCommand.None) return;
|
if (mode == SplendidCommand.None) return;
|
||||||
if ((mode == SplendidCommand.Disabled || mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init
|
if ((mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init
|
||||||
|
|
||||||
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
|
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
|
||||||
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
||||||
@@ -262,16 +245,12 @@ namespace GHelper.Display
|
|||||||
|
|
||||||
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
||||||
|
|
||||||
int? balance = null;
|
int? balance;
|
||||||
int command = 0;
|
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case SplendidCommand.Disabled:
|
|
||||||
command = 2;
|
|
||||||
break;
|
|
||||||
case SplendidCommand.Eyecare:
|
case SplendidCommand.Eyecare:
|
||||||
balance = 4;
|
balance = 2;
|
||||||
break;
|
break;
|
||||||
case SplendidCommand.VivoNormal:
|
case SplendidCommand.VivoNormal:
|
||||||
case SplendidCommand.VivoVivid:
|
case SplendidCommand.VivoVivid:
|
||||||
@@ -285,7 +264,7 @@ namespace GHelper.Display
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = RunSplendid(mode, command, balance);
|
var result = RunSplendid(mode, 0, balance);
|
||||||
if (result == 0) return;
|
if (result == 0) return;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
@@ -342,11 +321,6 @@ namespace GHelper.Display
|
|||||||
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
||||||
if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1;
|
if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1;
|
||||||
if (result.Contains("return code: -1")) return -1;
|
if (result.Contains("return code: -1")) return -1;
|
||||||
if (result.Contains("Visual is disabled"))
|
|
||||||
{
|
|
||||||
SetRegStatus(1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
18
app/Fans.cs
18
app/Fans.cs
@@ -757,8 +757,8 @@ namespace GHelper
|
|||||||
|
|
||||||
chart.Titles[0].Text = title;
|
chart.Titles[0].Text = title;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.Minimum = 10;
|
chart.ChartAreas[0].AxisX.Minimum = 20;
|
||||||
chart.ChartAreas[0].AxisX.Maximum = 100;
|
chart.ChartAreas[0].AxisX.Maximum = 110;
|
||||||
chart.ChartAreas[0].AxisX.Interval = 10;
|
chart.ChartAreas[0].AxisX.Interval = 10;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.Minimum = 0;
|
chart.ChartAreas[0].AxisY.Minimum = 0;
|
||||||
@@ -1019,7 +1019,7 @@ namespace GHelper
|
|||||||
int chartCount = 2;
|
int chartCount = 2;
|
||||||
|
|
||||||
// Middle / system fan check
|
// 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);
|
AppConfig.Set("mid_fan", 1);
|
||||||
chartCount++;
|
chartCount++;
|
||||||
@@ -1082,15 +1082,10 @@ namespace GHelper
|
|||||||
if (reset || AsusACPI.IsInvalidCurve(curve))
|
if (reset || AsusACPI.IsInvalidCurve(curve))
|
||||||
{
|
{
|
||||||
curve = Program.acpi.GetFanCurve(device, Modes.GetCurrentBase());
|
curve = Program.acpi.GetFanCurve(device, Modes.GetCurrentBase());
|
||||||
|
Logger.WriteLine($"Default {device}:" + BitConverter.ToString(curve));
|
||||||
if (AsusACPI.IsInvalidCurve(curve))
|
|
||||||
curve = AppConfig.GetDefaultCurve(device);
|
|
||||||
|
|
||||||
curve = AsusACPI.FixFanCurve(curve);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Debug.WriteLine(BitConverter.ToString(curve));
|
curve = AsusACPI.FixFanCurve(curve);
|
||||||
|
|
||||||
byte old = 0;
|
byte old = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
@@ -1245,8 +1240,7 @@ namespace GHelper
|
|||||||
dx = ax.PixelPositionToValue(e.X);
|
dx = ax.PixelPositionToValue(e.X);
|
||||||
dy = ay.PixelPositionToValue(e.Y);
|
dy = ay.PixelPositionToValue(e.Y);
|
||||||
|
|
||||||
if (dx < 20) dx = 20;
|
dx = AsusACPI.FixTemp((int)dx, curIndex);
|
||||||
if (dx > 100) dx = 100;
|
|
||||||
|
|
||||||
if (dy < 0) dy = 0;
|
if (dy < 0) dy = 0;
|
||||||
if (dy > fansMax) dy = fansMax;
|
if (dy > fansMax) dy = fansMax;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.196</AssemblyVersion>
|
<AssemblyVersion>0.195</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public static class HardwareControl
|
|||||||
public static decimal? fullCapacity;
|
public static decimal? fullCapacity;
|
||||||
public static decimal? chargeCapacity;
|
public static decimal? chargeCapacity;
|
||||||
|
|
||||||
public static string? batteryCharge;
|
|
||||||
|
|
||||||
public static string? cpuFan;
|
public static string? cpuFan;
|
||||||
public static string? gpuFan;
|
public static string? gpuFan;
|
||||||
@@ -34,20 +34,6 @@ public static class HardwareControl
|
|||||||
|
|
||||||
static long lastUpdate;
|
static long lastUpdate;
|
||||||
|
|
||||||
static bool _chargeWatt = AppConfig.Is("charge_watt");
|
|
||||||
public static bool chargeWatt
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _chargeWatt;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppConfig.Set("charge_watt", value ? 1 : 0);
|
|
||||||
_chargeWatt = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int GetGpuUse()
|
private static int GetGpuUse()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -240,16 +226,8 @@ public static class HardwareControl
|
|||||||
|
|
||||||
if (fullCapacity > 0 && chargeCapacity > 0)
|
if (fullCapacity > 0 && chargeCapacity > 0)
|
||||||
{
|
{
|
||||||
batteryCapacity = Math.Min(100, (decimal)chargeCapacity / (decimal)fullCapacity * 100);
|
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
|
||||||
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
||||||
if (chargeWatt)
|
|
||||||
{
|
|
||||||
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
batteryCharge = Math.Round(batteryCapacity, 1) + "%";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ namespace GHelper
|
|||||||
|
|
||||||
labelCharge.MouseEnter += PanelBattery_MouseEnter;
|
labelCharge.MouseEnter += PanelBattery_MouseEnter;
|
||||||
labelCharge.MouseLeave += PanelBattery_MouseLeave;
|
labelCharge.MouseLeave += PanelBattery_MouseLeave;
|
||||||
labelBattery.Click += LabelBattery_Click;
|
|
||||||
|
|
||||||
buttonPeripheral1.Click += ButtonPeripheral_Click;
|
buttonPeripheral1.Click += ButtonPeripheral_Click;
|
||||||
buttonPeripheral2.Click += ButtonPeripheral_Click;
|
buttonPeripheral2.Click += ButtonPeripheral_Click;
|
||||||
@@ -285,12 +284,6 @@ namespace GHelper
|
|||||||
InitVisual();
|
InitVisual();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LabelBattery_Click(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
HardwareControl.chargeWatt = !HardwareControl.chargeWatt;
|
|
||||||
RefreshSensors(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDonate_Click(object? sender, EventArgs e)
|
private void ButtonDonate_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("donate_click", 1);
|
AppConfig.Set("donate_click", 1);
|
||||||
@@ -1427,9 +1420,7 @@ namespace GHelper
|
|||||||
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
|
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
|
||||||
|
|
||||||
if (HardwareControl.batteryCapacity > 0)
|
if (HardwareControl.batteryCapacity > 0)
|
||||||
{
|
charge = Properties.Strings.BatteryCharge + ": " + Math.Round(HardwareControl.batteryCapacity, 1) + "% ";
|
||||||
charge = Properties.Strings.BatteryCharge + ": " + HardwareControl.batteryCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HardwareControl.batteryRate < 0)
|
if (HardwareControl.batteryRate < 0)
|
||||||
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
|
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
|
||||||
|
|||||||
Reference in New Issue
Block a user