mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5c47de3f2 |
@@ -25,6 +25,9 @@ public class ASUSWmi
|
||||
public const uint DevsCPUFanCurve = 0x00110024;
|
||||
public const uint DevsGPUFanCurve = 0x00110025;
|
||||
|
||||
public const int PPT_Total = 0x001200A0;
|
||||
public const int PPT_CPU = 0x001200B0;
|
||||
|
||||
public const int PerformanceBalanced = 0;
|
||||
public const int PerformanceTurbo = 1;
|
||||
public const int PerformanceSilent = 2;
|
||||
|
||||
160
Fans.Designer.cs
generated
160
Fans.Designer.cs
generated
@@ -34,23 +34,37 @@
|
||||
buttonApply = new Button();
|
||||
buttonReset = new Button();
|
||||
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
groupBox1 = new GroupBox();
|
||||
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();
|
||||
((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 +73,7 @@
|
||||
//
|
||||
// buttonReset
|
||||
//
|
||||
buttonReset.Location = new Point(16, 1016);
|
||||
buttonReset.Location = new Point(619, 1016);
|
||||
buttonReset.Name = "buttonReset";
|
||||
buttonReset.Size = new Size(254, 46);
|
||||
buttonReset.TabIndex = 2;
|
||||
@@ -70,17 +84,132 @@
|
||||
//
|
||||
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(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.Size = new Size(330, 979);
|
||||
groupBox1.TabIndex = 4;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Power Limits (PPT)";
|
||||
//
|
||||
// pictureFine
|
||||
//
|
||||
pictureFine.BackgroundImage = Properties.Resources.everything_is_fine_itsfine;
|
||||
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureFine.Location = new Point(12, 725);
|
||||
pictureFine.Name = "pictureFine";
|
||||
pictureFine.Size = new Size(304, 240);
|
||||
pictureFine.TabIndex = 12;
|
||||
pictureFine.TabStop = false;
|
||||
pictureFine.Visible = false;
|
||||
//
|
||||
// labelInfo
|
||||
//
|
||||
labelInfo.AutoSize = true;
|
||||
labelInfo.Location = new Point(22, 644);
|
||||
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(195, 99);
|
||||
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(37, 99);
|
||||
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(198, 57);
|
||||
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(39, 57);
|
||||
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, 154);
|
||||
trackCPU.Maximum = 85;
|
||||
trackCPU.Minimum = 15;
|
||||
trackCPU.Name = "trackCPU";
|
||||
trackCPU.Orientation = Orientation.Vertical;
|
||||
trackCPU.Size = new Size(90, 470);
|
||||
trackCPU.TabIndex = 6;
|
||||
trackCPU.TickFrequency = 5;
|
||||
trackCPU.Value = 80;
|
||||
//
|
||||
// trackTotal
|
||||
//
|
||||
trackTotal.Location = new Point(45, 154);
|
||||
trackTotal.Maximum = 150;
|
||||
trackTotal.Minimum = 15;
|
||||
trackTotal.Name = "trackTotal";
|
||||
trackTotal.Orientation = Orientation.Vertical;
|
||||
trackTotal.Size = new Size(90, 470);
|
||||
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;
|
||||
//
|
||||
// Fans
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(940, 1089);
|
||||
ClientSize = new Size(1154, 1089);
|
||||
Controls.Add(buttonApplyPower);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(chartGPU);
|
||||
Controls.Add(buttonReset);
|
||||
Controls.Add(buttonApply);
|
||||
@@ -93,9 +222,14 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -105,5 +239,15 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
83
Fans.cs
83
Fans.cs
@@ -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)
|
||||
{
|
||||
|
||||
@@ -74,10 +82,85 @@ 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;
|
||||
|
||||
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!";
|
||||
|
||||
VisualisePower(true);
|
||||
|
||||
Shown += Fans_Shown;
|
||||
|
||||
}
|
||||
|
||||
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_CPU, limit_cpu);
|
||||
|
||||
}
|
||||
|
||||
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 LoadFans()
|
||||
{
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<AssemblyName>GHelper</AssemblyName>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AssemblyVersion>0.9.9.0</AssemblyVersion>
|
||||
<AssemblyVersion>0.10.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
10
Properties/Resources.Designer.cs
generated
10
Properties/Resources.Designer.cs
generated
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
BIN
Resources/everything-is-fine-itsfine.gif
Normal file
BIN
Resources/everything-is-fine-itsfine.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 220 KiB |
2
Settings.Designer.cs
generated
2
Settings.Designer.cs
generated
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user