Compare commits

..

10 Commits

Author SHA1 Message Date
seerge
4b38d380b5 Fan label calibration 2023-03-02 12:51:56 +01:00
seerge
9a2f9afe5b Minor fixes, fan RPM display 2023-03-02 12:22:52 +01:00
seerge
ce9ec1b6df Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-02 00:07:15 +01:00
seerge
e68282050b Fan curve auto apply 2023-03-02 00:07:07 +01:00
seerge
6b8f61fab4 Update README.md 2023-03-01 18:36:53 +01:00
seerge
f59070cb96 Minor fixes 2023-03-01 11:45:43 +01:00
seerge
f47a00fde2 Update README.md 2023-02-28 19:42:30 +01:00
seerge
b15c15974e New screenshot 2023-02-28 19:25:04 +01:00
seerge
b5c47de3f2 Added power limits 2023-02-28 19:17:16 +01:00
seerge
6b88fe67d3 Fix for possible missing fans curve on G15 2023-02-28 17:32:47 +01:00
14 changed files with 581 additions and 147 deletions

View File

@@ -25,6 +25,13 @@ public class ASUSWmi
public const uint DevsCPUFanCurve = 0x00110024;
public const uint DevsGPUFanCurve = 0x00110025;
public const int PPT_Total = 0x001200A0;
public const int PPT_Total1 = 0x001200A1;
public const int PPT_Total2 = 0x001200A2;
public const int PPT_CPU = 0x001200B0;
public const int PPT_CPU1 = 0x001200B1;
public const int PerformanceBalanced = 0;
public const int PerformanceTurbo = 1;
public const int PerformanceSilent = 2;
@@ -162,6 +169,11 @@ public class ASUSWmi
public void SetFanCurve(int device, byte[] curve)
{
if (curve.Length != 16) return;
if (curve.All(singleByte => singleByte == 0)) return;
Debug.WriteLine(BitConverter.ToString(curve));
if (device == 1)
DeviceSet(DevsGPUFanCurve, curve);
else

144
AppConfig.cs Normal file
View File

@@ -0,0 +1,144 @@
using System.Text.Json;
public class AppConfig
{
string appPath;
string configFile;
public Dictionary<string, object> config = new Dictionary<string, object>();
public AppConfig()
{
appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
configFile = appPath + "\\config.json";
if (!System.IO.Directory.Exists(appPath))
System.IO.Directory.CreateDirectory(appPath);
if (File.Exists(configFile))
{
string text = File.ReadAllText(configFile);
try
{
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);
}
catch
{
initConfig();
}
}
else
{
initConfig();
}
}
private void initConfig()
{
config = new Dictionary<string, object>();
config["performance_mode"] = 0;
string jsonString = JsonSerializer.Serialize(config);
File.WriteAllText(configFile, jsonString);
}
public int getConfig(string name)
{
if (config.ContainsKey(name))
return int.Parse(config[name].ToString());
else return -1;
}
public string getConfigString(string name)
{
if (config.ContainsKey(name))
return config[name].ToString();
else return null;
}
public void setConfig(string name, int value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
}
public void setConfig(string name, string value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
}
public string getParamName(int device, string paramName = "fan_profile")
{
int mode = getConfig("performance_mode");
string name;
if (device == 1)
name = "gpu";
else
name = "cpu";
return paramName+"_" + name + "_" + mode;
}
public byte[] getFanConfig(int device)
{
string curveString = getConfigString(getParamName(device));
byte[] curve = { };
if (curveString is not null)
curve = StringToBytes(curveString);
return curve;
}
public void setFanConfig(int device, byte[] curve)
{
string bitCurve = BitConverter.ToString(curve);
setConfig(getParamName(device), bitCurve);
}
public static byte[] StringToBytes(string str)
{
String[] arr = str.Split('-');
byte[] array = new byte[arr.Length];
for (int i = 0; i < arr.Length; i++) array[i] = Convert.ToByte(arr[i], 16);
return array;
}
public byte[] getDefaultCurve(int device)
{
int mode = getConfig("performance_mode");
byte[] curve;
switch (mode)
{
case 1:
if (device == 1)
curve = StringToBytes("14-3F-44-48-4C-50-54-62-16-1F-26-2D-39-47-55-5F");
else
curve = StringToBytes("14-3F-44-48-4C-50-54-62-11-1A-22-29-34-43-51-5A");
break;
case 2:
if (device == 1)
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-08-11-11-1D-1D-26-26-2D");
else
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-03-0C-0C-16-16-22-22-29");
break;
default:
if (device == 1)
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-0C-16-1D-1F-26-2D-34-4A");
else
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-08-11-16-1A-22-29-30-45");
break;
}
return curve;
}
}

16
Aura.cs
View File

@@ -10,7 +10,7 @@ public class Aura
public const int Breathe = 1;
public const int Strobe = 2;
public const int Rainbow = 3;
public const int Dingding = 10;
public const int Dingding = 4;
public const int SpeedSlow = 0xe1;
public const int SpeedMedium = 0xeb;
@@ -47,6 +47,20 @@ public class Aura
HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
if (Mode == Dingding)
{
Mode = 10;
Speed = SpeedMedium;
}
else if (Mode == Rainbow)
{
Speed = SpeedMedium;
}
else
{
Speed = SpeedSlow;
}
foreach (HidDevice device in HidDeviceList)
{
if (device.IsConnected)

190
Fans.Designer.cs generated
View File

@@ -34,23 +34,39 @@
buttonApply = new Button();
buttonReset = new Button();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
groupBox1 = new GroupBox();
labelApplied = new Label();
pictureFine = new PictureBox();
labelInfo = new Label();
labelCPU = new Label();
labelTotal = new Label();
label2 = new Label();
label1 = new Label();
trackCPU = new TrackBar();
trackTotal = new TrackBar();
buttonApplyPower = new Button();
checkAuto = new CheckBox();
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureFine).BeginInit();
((System.ComponentModel.ISupportInitialize)trackCPU).BeginInit();
((System.ComponentModel.ISupportInitialize)trackTotal).BeginInit();
SuspendLayout();
//
// chartCPU
//
chartArea1.Name = "ChartArea1";
chartCPU.ChartAreas.Add(chartArea1);
chartCPU.Location = new Point(16, 13);
chartCPU.Location = new Point(362, 30);
chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(900, 480);
chartCPU.Size = new Size(772, 464);
chartCPU.TabIndex = 0;
chartCPU.Text = "chartCPU";
//
// buttonApply
//
buttonApply.Location = new Point(661, 1016);
buttonApply.Location = new Point(879, 1016);
buttonApply.Name = "buttonApply";
buttonApply.Size = new Size(254, 46);
buttonApply.TabIndex = 1;
@@ -59,7 +75,7 @@
//
// buttonReset
//
buttonReset.Location = new Point(16, 1016);
buttonReset.Location = new Point(362, 1016);
buttonReset.Name = "buttonReset";
buttonReset.Size = new Size(254, 46);
buttonReset.TabIndex = 2;
@@ -70,17 +86,157 @@
//
chartArea2.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea2);
chartGPU.Location = new Point(16, 513);
chartGPU.Location = new Point(362, 511);
chartGPU.Name = "chartGPU";
chartGPU.Size = new Size(900, 480);
chartGPU.Size = new Size(772, 480);
chartGPU.TabIndex = 3;
chartGPU.Text = "chart1";
//
// groupBox1
//
groupBox1.Controls.Add(labelApplied);
groupBox1.Controls.Add(pictureFine);
groupBox1.Controls.Add(labelInfo);
groupBox1.Controls.Add(labelCPU);
groupBox1.Controls.Add(labelTotal);
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(label1);
groupBox1.Controls.Add(trackCPU);
groupBox1.Controls.Add(trackTotal);
groupBox1.Location = new Point(12, 12);
groupBox1.Name = "groupBox1";
groupBox1.Padding = new Padding(5);
groupBox1.Size = new Size(330, 979);
groupBox1.TabIndex = 4;
groupBox1.TabStop = false;
groupBox1.Text = "Power Limits (PPT)";
//
// labelApplied
//
labelApplied.AutoSize = true;
labelApplied.ForeColor = Color.Tomato;
labelApplied.Location = new Point(14, 39);
labelApplied.Name = "labelApplied";
labelApplied.Size = new Size(143, 32);
labelApplied.TabIndex = 13;
labelApplied.Text = "Not Applied";
//
// pictureFine
//
pictureFine.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
pictureFine.BackgroundImage = Properties.Resources.everything_is_fine_itsfine;
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
pictureFine.Location = new Point(9, 730);
pictureFine.Name = "pictureFine";
pictureFine.Size = new Size(311, 240);
pictureFine.TabIndex = 12;
pictureFine.TabStop = false;
pictureFine.Visible = false;
//
// labelInfo
//
labelInfo.AutoSize = true;
labelInfo.Dock = DockStyle.Bottom;
labelInfo.Location = new Point(5, 942);
labelInfo.Name = "labelInfo";
labelInfo.Size = new Size(65, 32);
labelInfo.TabIndex = 11;
labelInfo.Text = "label";
//
// labelCPU
//
labelCPU.AutoSize = true;
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelCPU.Location = new Point(197, 125);
labelCPU.Name = "labelCPU";
labelCPU.Size = new Size(61, 32);
labelCPU.TabIndex = 10;
labelCPU.Text = "CPU";
labelCPU.TextAlign = ContentAlignment.MiddleCenter;
//
// labelTotal
//
labelTotal.AutoSize = true;
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTotal.Location = new Point(39, 125);
labelTotal.Name = "labelTotal";
labelTotal.Size = new Size(70, 32);
labelTotal.TabIndex = 9;
labelTotal.Text = "Total";
labelTotal.TextAlign = ContentAlignment.MiddleCenter;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(200, 91);
label2.Name = "label2";
label2.Size = new Size(58, 32);
label2.TabIndex = 8;
label2.Text = "CPU";
label2.TextAlign = ContentAlignment.MiddleCenter;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(41, 91);
label1.Name = "label1";
label1.Size = new Size(65, 32);
label1.TabIndex = 7;
label1.Text = "Total";
label1.TextAlign = ContentAlignment.MiddleCenter;
//
// trackCPU
//
trackCPU.Location = new Point(203, 178);
trackCPU.Maximum = 85;
trackCPU.Minimum = 15;
trackCPU.Name = "trackCPU";
trackCPU.Orientation = Orientation.Vertical;
trackCPU.Size = new Size(90, 444);
trackCPU.TabIndex = 6;
trackCPU.TickFrequency = 5;
trackCPU.Value = 80;
//
// trackTotal
//
trackTotal.Location = new Point(42, 178);
trackTotal.Maximum = 150;
trackTotal.Minimum = 15;
trackTotal.Name = "trackTotal";
trackTotal.Orientation = Orientation.Vertical;
trackTotal.Size = new Size(90, 444);
trackTotal.TabIndex = 5;
trackTotal.TickFrequency = 5;
trackTotal.TickStyle = TickStyle.TopLeft;
trackTotal.Value = 125;
//
// buttonApplyPower
//
buttonApplyPower.Location = new Point(15, 1016);
buttonApplyPower.Name = "buttonApplyPower";
buttonApplyPower.Size = new Size(327, 46);
buttonApplyPower.TabIndex = 11;
buttonApplyPower.Text = "Apply Power Limits";
buttonApplyPower.UseVisualStyleBackColor = true;
//
// checkAuto
//
checkAuto.AutoSize = true;
checkAuto.Location = new Point(708, 1022);
checkAuto.Name = "checkAuto";
checkAuto.Size = new Size(165, 36);
checkAuto.TabIndex = 12;
checkAuto.Text = "Auto Apply";
checkAuto.UseVisualStyleBackColor = true;
//
// Fans
//
AutoScaleDimensions = new SizeF(13F, 32F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(940, 1089);
ClientSize = new Size(1154, 1089);
Controls.Add(checkAuto);
Controls.Add(buttonApplyPower);
Controls.Add(groupBox1);
Controls.Add(chartGPU);
Controls.Add(buttonReset);
Controls.Add(buttonApply);
@@ -93,10 +249,16 @@
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = FormStartPosition.CenterScreen;
Text = "Fans";
Text = "Fans and Power";
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureFine).EndInit();
((System.ComponentModel.ISupportInitialize)trackCPU).EndInit();
((System.ComponentModel.ISupportInitialize)trackTotal).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
@@ -105,5 +267,17 @@
private Button buttonApply;
private Button buttonReset;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private GroupBox groupBox1;
private Label labelCPU;
private Label labelTotal;
private Label label2;
private Label label1;
private TrackBar trackCPU;
private TrackBar trackTotal;
private Button buttonApplyPower;
private Label labelInfo;
private PictureBox pictureFine;
private Label labelApplied;
private CheckBox checkAuto;
}
}

179
Fans.cs
View File

@@ -11,6 +11,14 @@ namespace GHelper
Series seriesCPU;
Series seriesGPU;
const int MaxTotal = 150;
const int MinTotal = 15;
const int DefaultTotal = 125;
const int MaxCPU = 90;
const int MinCPU = 15;
const int DefaultCPU = 80;
void SetChart(Chart chart, int device)
{
@@ -29,13 +37,25 @@ namespace GHelper
else
chart.Titles.Add(title);
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisX.Minimum = 10;
chart.ChartAreas[0].AxisX.Maximum = 100;
chart.ChartAreas[0].AxisX.Interval = 10;
chart.ChartAreas[0].AxisY.Minimum = 0;
chart.ChartAreas[0].AxisY.Maximum = 100;
chart.ChartAreas[0].AxisX.Interval = 10;
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
chart.ChartAreas[0].AxisY.CustomLabels.Add(-2, 2, "OFF");
for (int i = 1; i<= 9;i++)
chart.ChartAreas[0].AxisY.CustomLabels.Add(i*10-2, i*10+2, (1800+400*i).ToString());
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
chart.ChartAreas[0].AxisY.Interval = 10;
if (chart.Legends.Count > 0)
@@ -54,14 +74,14 @@ namespace GHelper
InitializeComponent();
FormClosing += Fans_FormClosing;
seriesCPU = chartCPU.Series.Add("CPU");
seriesGPU = chartGPU.Series.Add("GPU");
seriesCPU.Color = Color.Blue;
seriesGPU.Color = Color.Red;
LoadFans();
chartCPU.MouseMove += ChartCPU_MouseMove;
chartCPU.MouseUp += ChartCPU_MouseUp;
@@ -71,10 +91,120 @@ namespace GHelper
buttonReset.Click += ButtonReset_Click;
buttonApply.Click += ButtonApply_Click;
trackTotal.Maximum = MaxTotal;
trackTotal.Minimum = MinTotal;
trackCPU.Maximum = MaxCPU;
trackCPU.Minimum = MinCPU;
trackCPU.Scroll += TrackCPU_Scroll;
trackTotal.Scroll += TrackTotal_Scroll;
buttonApplyPower.Click += ButtonApplyPower_Click;
checkAuto.Click += CheckAuto_Click;
labelInfo.MaximumSize = new Size(300, 0);
labelInfo.Text = "Power Limits (PPT) is experimental feature.\n\nValues will be applied only after you click 'Apply' and reset after performance mode change.\n\nUse carefully and on your own risk!";
LoadFans();
VisualisePower(true);
Shown += Fans_Shown;
}
private void CheckAuto_Click(object? sender, EventArgs e)
{
if (sender is null)
return;
CheckBox chk = (CheckBox)sender;
Program.config.setConfig("auto_apply_" + Program.config.getConfig("performance_mode"), chk.Checked ? 1 : 0);
}
private void Fans_FormClosing(object? sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
private void ButtonApplyPower_Click(object? sender, EventArgs e)
{
int limit_total = trackTotal.Value;
int limit_cpu = trackCPU.Value;
Program.config.setConfig("limit_total", limit_total);
Program.config.setConfig("limit_cpu", limit_cpu);
Program.wmi.DeviceSet(ASUSWmi.PPT_Total, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_Total1, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_Total2, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_CPU, limit_cpu);
//Program.wmi.DeviceSet(ASUSWmi.PPT_CPU1, limit_cpu);
labelApplied.ForeColor = Color.Blue;
labelApplied.Text = "Applied";
}
public void VisualisePower(bool init = false)
{
int limit_total;
int limit_cpu;
if (init)
{
limit_total = Program.config.getConfig("limit_total");
limit_cpu = Program.config.getConfig("limit_cpu");
}
else
{
limit_total = trackTotal.Value;
limit_cpu = trackCPU.Value;
}
if (limit_total < 0) limit_total = DefaultTotal;
if (limit_total > MaxTotal) limit_total = MaxTotal;
if (limit_total < MinTotal) limit_total = MinTotal;
if (limit_cpu < 0) limit_cpu = DefaultCPU;
if (limit_cpu > MaxCPU) limit_cpu = MaxCPU;
if (limit_cpu < MinCPU) limit_cpu = MinCPU;
if (limit_cpu > limit_total) limit_cpu = limit_total;
trackTotal.Value = limit_total;
trackCPU.Value = limit_cpu;
labelTotal.Text = trackTotal.Value.ToString() + "W";
labelCPU.Text = trackCPU.Value.ToString() + "W";
pictureFine.Visible = (limit_cpu > 85 || limit_total > 145);
}
private void TrackTotal_Scroll(object? sender, EventArgs e)
{
VisualisePower();
}
private void TrackCPU_Scroll(object? sender, EventArgs e)
{
VisualisePower();
}
public void ResetApplyLabel()
{
labelApplied.ForeColor = Color.Red;
labelApplied.Text = "Not Applied";
}
public void LoadFans()
{
@@ -84,28 +214,12 @@ namespace GHelper
LoadProfile(seriesCPU, 0);
LoadProfile(seriesGPU, 1);
int auto_apply = Program.config.getConfig("auto_apply_" + Program.config.getConfig("performance_mode"));
checkAuto.Checked = (auto_apply == 1);
}
byte[] StringToBytes(string str)
{
String[] arr = str.Split('-');
byte[] array = new byte[arr.Length];
for (int i = 0; i < arr.Length; i++) array[i] = Convert.ToByte(arr[i], 16);
return array;
}
string GetFanName(int device)
{
int mode = Program.config.getConfig("performance_mode");
string name;
if (device == 1)
name = "gpu";
else
name = "cpu";
return "fan_profile_" + name + "_" + mode;
}
void LoadProfile(Series series, int device, int def = 0)
{
@@ -117,15 +231,13 @@ namespace GHelper
series.Points.Clear();
int mode = Program.config.getConfig("performance_mode");
string curveString = Program.config.getConfigString(GetFanName(device));
byte[] curve = { };
if (curveString is not null)
curve = StringToBytes(curveString);
byte[] curve = Program.config.getFanConfig(device);
if (def == 1 || curve.Length != 16)
curve = Program.wmi.GetFanCurve(device, mode);
if (curve.All(singleByte => singleByte == 0))
Program.config.getDefaultCurve(device);
//Debug.WriteLine(BitConverter.ToString(curve));
@@ -150,10 +262,7 @@ namespace GHelper
i++;
}
string bitCurve = BitConverter.ToString(curve);
Debug.WriteLine(bitCurve);
Program.config.setConfig(GetFanName(device), bitCurve);
Program.config.setFanConfig(device, curve);
Program.wmi.SetFanCurve(device, curve);
}
@@ -169,7 +278,13 @@ namespace GHelper
{
LoadProfile(seriesCPU, 0, 1);
LoadProfile(seriesGPU, 1, 1);
checkAuto.Checked = false;
Program.config.setConfig("auto_apply_" + Program.config.getConfig("performance_mode"), 0);
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"));
ResetApplyLabel();
}
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)

View File

@@ -15,7 +15,7 @@
<AssemblyName>GHelper</AssemblyName>
<PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AssemblyVersion>0.9.8.0</AssemblyVersion>
<AssemblyVersion>0.12.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,82 +1,6 @@
using Microsoft.Win32;
using System.Diagnostics;
using System.Management;
using System.Text.Json;
public class AppConfig
{
string appPath;
string configFile;
public Dictionary<string, object> config = new Dictionary<string, object>();
public AppConfig()
{
appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
configFile = appPath + "\\config.json";
if (!System.IO.Directory.Exists(appPath))
System.IO.Directory.CreateDirectory(appPath);
if (File.Exists(configFile))
{
string text = File.ReadAllText(configFile);
try
{
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);
}
catch
{
initConfig();
}
}
else
{
initConfig();
}
}
private void initConfig()
{
config = new Dictionary<string, object>();
config["performance_mode"] = 0;
string jsonString = JsonSerializer.Serialize(config);
File.WriteAllText(configFile, jsonString);
}
public int getConfig(string name)
{
if (config.ContainsKey(name))
return int.Parse(config[name].ToString());
else return -1;
}
public string getConfigString(string name)
{
if (config.ContainsKey(name))
return config[name].ToString();
else return null;
}
public void setConfig(string name, int value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
}
public void setConfig(string name, string value)
{
config[name] = value;
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configFile, jsonString);
}
}
public class HardwareMonitor
{
@@ -176,7 +100,8 @@ namespace GHelper
try
{
Process proc = Process.Start(start);
} catch
}
catch
{
Debug.WriteLine("Failed to run " + fileName);
}
@@ -269,6 +194,9 @@ namespace GHelper
settingsForm.Show();
settingsForm.Activate();
}
settingsForm.VisualiseGPUMode();
}
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)

View File

@@ -70,6 +70,16 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap everything_is_fine_itsfine {
get {
object obj = ResourceManager.GetObject("everything-is-fine-itsfine", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -139,13 +139,16 @@
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="everything-is-fine-itsfine" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\everything-is-fine-itsfine.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -2,6 +2,8 @@
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
### NEW! Experimental feature: **Set Power limits (PPT) - Total and CPU**.
1. Switch between default **Performance modes** - Silent / Balanced / Turbo and apply default fan curves
2. Switch between Eco / Standard or Ultimate **GPU modes**
3. Change laptop screen refresh rate - 60hz or your maximum (120hz, 144hz, etc depending on the model) with display overdrive (OD)
@@ -11,10 +13,10 @@ A small utility that allows you do almost everyting you could do with Armory Cra
7. Monitor CPU temperature, fan speeds and battery discharge rate
8. **Automatically switch to Eco(iGPU)/60hz on battery** and back to Standard(GPU)/120hz modes when plugged
9. Support for M4 key / FN+F5 to cycle through performance modes (with OSD notification) and FN+F4 to cycle through keeyboard animation modes
10. Basic keybindings for M3 amd M4 keys
10. Basic keybindings for M3 and M4 keys
11. Turn cpu turbo boost on/off with one checkbox to keep temps cooler
Designed and developer for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features.
Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features.
To keep autoswitching and hotkeys work app needs to stay in running in tray. It doesn't consume any resources.

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

16
Settings.Designer.cs generated
View File

@@ -132,12 +132,12 @@
// labelGPUFan
//
labelGPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelGPUFan.Location = new Point(410, 262);
labelGPUFan.Location = new Point(338, 262);
labelGPUFan.Margin = new Padding(4, 0, 4, 0);
labelGPUFan.Name = "labelGPUFan";
labelGPUFan.Size = new Size(276, 32);
labelGPUFan.Size = new Size(348, 32);
labelGPUFan.TabIndex = 8;
labelGPUFan.Text = "GPU Fan : 0%";
labelGPUFan.Text = "GPU Fan";
labelGPUFan.TextAlign = ContentAlignment.TopRight;
//
// tableGPU
@@ -226,12 +226,12 @@
// labelCPUFan
//
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelCPUFan.Location = new Point(410, 38);
labelCPUFan.Location = new Point(320, 38);
labelCPUFan.Margin = new Padding(4, 0, 4, 0);
labelCPUFan.Name = "labelCPUFan";
labelCPUFan.Size = new Size(276, 32);
labelCPUFan.Size = new Size(366, 32);
labelCPUFan.TabIndex = 12;
labelCPUFan.Text = "CPU Fan : 0%";
labelCPUFan.Text = "CPU Fan";
labelCPUFan.TextAlign = ContentAlignment.TopRight;
//
// tablePerf
@@ -468,7 +468,7 @@
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboKeyboard.FormattingEnabled = true;
comboKeyboard.ItemHeight = 32;
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Strobe", "Rainbow" });
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Strobe", "Rainbow", "Dingding" });
comboKeyboard.Location = new Point(32, 778);
comboKeyboard.Margin = new Padding(0);
comboKeyboard.Name = "comboKeyboard";
@@ -512,7 +512,7 @@
buttonFans.Name = "buttonFans";
buttonFans.Size = new Size(210, 48);
buttonFans.TabIndex = 28;
buttonFans.Text = "Fan Profile";
buttonFans.Text = "Fans and Power";
buttonFans.UseVisualStyleBackColor = false;
//
// buttonKeyboard

View File

@@ -1,7 +1,7 @@
using System.Diagnostics;
using System.Reflection;
using System.Security.Cryptography;
using System.Timers;
using System.Windows.Forms.DataVisualization.Charting;
namespace GHelper
{
@@ -75,12 +75,21 @@ namespace GHelper
labelVersion.Text = "Version " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
labelVersion.Click += LabelVersion_Click;
labelCPUFan.Click += LabelCPUFan_Click;
labelGPUFan.Click += LabelCPUFan_Click;
SetTimer();
}
private void LabelCPUFan_Click(object? sender, EventArgs e)
{
Program.config.setConfig("fan_rpm", (Program.config.getConfig("fan_rpm") == 1) ? 0 : 1);
RefreshSensors();
}
private void LabelVersion_Click(object? sender, EventArgs e)
{
Process.Start(new ProcessStartInfo("http://github.com/seerge/g-helper/releases") { UseShellExecute = true });
@@ -122,13 +131,19 @@ namespace GHelper
if (fans == null || fans.Text == "")
{
fans = new Fans();
fans.Show();
Debug.WriteLine("Starting fans");
}
if (fans.Visible)
{
fans.Hide();
}
else
{
fans.Close();
fans.Show();
}
}
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
@@ -205,14 +220,14 @@ namespace GHelper
//Debug.WriteLine(mode);
if (mode > 3) mode = 0;
if (mode > 4) mode = 0;
pictureColor2.Visible = (mode == Aura.Breathe);
if (Aura.Mode == mode) return; // same mode
Aura.Mode = mode;
Program.config.setConfig("aura_mode", mode);
comboKeyboard.SelectedValueChanged -= ComboKeyboard_SelectedValueChanged;
@@ -397,10 +412,20 @@ namespace GHelper
aTimer.Enabled = false;
}
private static string FormatFan(int fan)
{
if (Program.config.getConfig("fan_rpm") == 1)
return " Fan: " + (fan * 100).ToString() + "RPM";
else
return " Fan: " + Math.Round(fan / 0.6).ToString() + "%"; // relatively to 6000 rpm
}
private static void RefreshSensors()
{
string cpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6).ToString() + "%";
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6).ToString() + "%";
string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
string cpuTemp = "";
string gpuTemp = "";
@@ -425,7 +450,7 @@ namespace GHelper
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
RefreshSensors();
aTimer.Interval = 2000;
aTimer.Interval = 1000;
}
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
@@ -438,7 +463,7 @@ namespace GHelper
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
this.Activate();
aTimer.Interval = 500;
aTimer.Interval = 100;
aTimer.Enabled = true;
}
@@ -474,17 +499,19 @@ namespace GHelper
Program.config.setConfig("performance_mode", PerformanceMode);
try
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
if (Program.config.getConfig("auto_apply_" + PerformanceMode) == 1)
{
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
}
catch
{
labelPerf.Text = "Performance Mode: not supported";
Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
}
if (fans != null && fans.Text != "")
{
fans.LoadFans();
fans.ResetApplyLabel();
}
if (notify)
{
@@ -643,9 +670,14 @@ namespace GHelper
checkScreen.Checked = (ScreenAuto == 1);
}
public void VisualiseGPUMode(int GPUMode)
public void VisualiseGPUMode(int GPUMode = -1)
{
if (GPUMode == -1)
{
GPUMode = Program.config.getConfig("gpu_mode");
}
buttonEco.FlatAppearance.BorderSize = buttonInactive;
buttonStandard.FlatAppearance.BorderSize = buttonInactive;
buttonUltimate.FlatAppearance.BorderSize = buttonInactive;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB