Minor fixes

This commit is contained in:
seerge
2023-03-01 11:45:43 +01:00
parent f47a00fde2
commit f59070cb96
7 changed files with 90 additions and 20 deletions

View File

@@ -26,7 +26,11 @@ public class ASUSWmi
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;

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)

29
Fans.Designer.cs generated
View File

@@ -35,6 +35,7 @@
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();
@@ -92,6 +93,7 @@
//
// groupBox1
//
groupBox1.Controls.Add(labelApplied);
groupBox1.Controls.Add(pictureFine);
groupBox1.Controls.Add(labelInfo);
groupBox1.Controls.Add(labelCPU);
@@ -107,6 +109,16 @@
groupBox1.TabStop = false;
groupBox1.Text = "Power Limits (PPT)";
//
// labelApplied
//
labelApplied.AutoSize = true;
labelApplied.ForeColor = Color.Tomato;
labelApplied.Location = new Point(12, 37);
labelApplied.Name = "labelApplied";
labelApplied.Size = new Size(143, 32);
labelApplied.TabIndex = 13;
labelApplied.Text = "Not Applied";
//
// pictureFine
//
pictureFine.BackgroundImage = Properties.Resources.everything_is_fine_itsfine;
@@ -131,7 +143,7 @@
//
labelCPU.AutoSize = true;
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelCPU.Location = new Point(195, 99);
labelCPU.Location = new Point(195, 123);
labelCPU.Name = "labelCPU";
labelCPU.Size = new Size(61, 32);
labelCPU.TabIndex = 10;
@@ -142,7 +154,7 @@
//
labelTotal.AutoSize = true;
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTotal.Location = new Point(37, 99);
labelTotal.Location = new Point(37, 123);
labelTotal.Name = "labelTotal";
labelTotal.Size = new Size(70, 32);
labelTotal.TabIndex = 9;
@@ -152,7 +164,7 @@
// label2
//
label2.AutoSize = true;
label2.Location = new Point(198, 57);
label2.Location = new Point(198, 89);
label2.Name = "label2";
label2.Size = new Size(58, 32);
label2.TabIndex = 8;
@@ -162,7 +174,7 @@
// label1
//
label1.AutoSize = true;
label1.Location = new Point(39, 57);
label1.Location = new Point(39, 89);
label1.Name = "label1";
label1.Size = new Size(65, 32);
label1.TabIndex = 7;
@@ -171,24 +183,24 @@
//
// trackCPU
//
trackCPU.Location = new Point(203, 154);
trackCPU.Location = new Point(203, 178);
trackCPU.Maximum = 85;
trackCPU.Minimum = 15;
trackCPU.Name = "trackCPU";
trackCPU.Orientation = Orientation.Vertical;
trackCPU.Size = new Size(90, 470);
trackCPU.Size = new Size(90, 444);
trackCPU.TabIndex = 6;
trackCPU.TickFrequency = 5;
trackCPU.Value = 80;
//
// trackTotal
//
trackTotal.Location = new Point(45, 154);
trackTotal.Location = new Point(42, 178);
trackTotal.Maximum = 150;
trackTotal.Minimum = 15;
trackTotal.Name = "trackTotal";
trackTotal.Orientation = Orientation.Vertical;
trackTotal.Size = new Size(90, 470);
trackTotal.Size = new Size(90, 444);
trackTotal.TabIndex = 5;
trackTotal.TickFrequency = 5;
trackTotal.TickStyle = TickStyle.TopLeft;
@@ -249,5 +261,6 @@
private Button buttonApplyPower;
private Label labelInfo;
private PictureBox pictureFine;
private Label labelApplied;
}
}

28
Fans.cs
View File

@@ -65,14 +65,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;
@@ -96,12 +96,22 @@ namespace GHelper
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 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;
@@ -111,7 +121,14 @@ namespace GHelper
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";
}
@@ -161,6 +178,12 @@ namespace GHelper
VisualisePower();
}
public void ResetApplyLabel()
{
labelApplied.ForeColor = Color.Red;
labelApplied.Text = "Not Applied";
}
public void LoadFans()
{
@@ -283,6 +306,7 @@ namespace GHelper
LoadProfile(seriesCPU, 0, 1);
LoadProfile(seriesGPU, 1, 1);
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"));
ResetApplyLabel();
}
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)

View File

@@ -269,6 +269,9 @@ namespace GHelper
settingsForm.Show();
settingsForm.Activate();
}
settingsForm.VisualiseGPUMode();
}
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)

2
Settings.Designer.cs generated
View File

@@ -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";

View File

@@ -1,7 +1,6 @@
using System.Diagnostics;
using System.Reflection;
using System.Timers;
using System.Windows.Forms.DataVisualization.Charting;
namespace GHelper
{
@@ -122,12 +121,17 @@ namespace GHelper
if (fans == null || fans.Text == "")
{
fans = new Fans();
Debug.WriteLine("Starting fans");
}
if (fans.Visible)
{
fans.Hide();
} else
{
fans.Show();
}
else
{
fans.Close();
}
}
@@ -205,14 +209,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;
@@ -484,7 +488,10 @@ namespace GHelper
}
if (fans != null && fans.Text != "")
{
fans.LoadFans();
fans.ResetApplyLabel();
}
if (notify)
{
@@ -643,9 +650,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;