Compare commits

...

10 Commits
v0.35 ... v0.37

Author SHA1 Message Date
seerge
64871e5554 Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-23 00:38:06 +01:00
seerge
b1c778b30d Minor tweaks 2023-03-23 00:38:03 +01:00
Serge
6932bb1889 Update README.md 2023-03-22 17:55:10 +01:00
seerge
c90a342ce8 Fixed possible memory leack with clock ticks 2023-03-22 17:28:09 +01:00
seerge
f223ca4a33 Added informational toolip 2023-03-22 17:15:20 +01:00
seerge
023607da4b Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-22 14:38:04 +01:00
seerge
264631ab77 Added animatrix Clock 2023-03-22 14:38:01 +01:00
Serge
1bd5d79983 Update README.md 2023-03-21 17:40:06 +01:00
seerge
83b184a061 - 2023-03-21 15:23:41 +01:00
seerge
9ff572b8f6 UI tweaks, mid fan support 2023-03-21 13:14:53 +01:00
12 changed files with 239 additions and 155 deletions

View File

@@ -12,6 +12,7 @@ public class ASUSWmi
public const uint CPU_Fan = 0x00110013;
public const uint GPU_Fan = 0x00110014;
public const uint Mid_Fan = 0x00110031;
public const uint PerformanceMode = 0x00120075; // Thermal Control

View File

@@ -1,7 +1,6 @@
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
using Starlight.Communication;
using System.Diagnostics;
using System.Management;
using System.Text;
@@ -62,8 +61,7 @@ namespace Starlight.AnimeMatrix
Off = 0,
Dim = 1,
Medium = 2,
Full = 3,
Super = 4, //test, doesn't work
Full = 3
}
@@ -75,11 +73,11 @@ namespace Starlight.AnimeMatrix
byte[] _displayBuffer;
List<byte[]> frames = new List<byte[]>();
public int MaxColumns = 34;
public int MaxRows = 61;
public int FullRows = 11;
public int FullEvenRows = -1;
public int EmptyFirstRow = 1;
public int MaxColumns = 34;
private int frameIndex = 0;
@@ -87,14 +85,13 @@ namespace Starlight.AnimeMatrix
: base(0x0B05, 0x193B, 640)
{
string model = GetModel();
Logger.WriteLine("Animatrix: " + model);
if (model.Contains("401"))
{
EmptyFirstRow = 1;
FullRows = 6;
MaxColumns = 33;
FullRows = 7;
FullEvenRows = 1;
MaxRows = 55;
LedCount = 1214;
UpdatePageLength = 410;
@@ -154,7 +151,7 @@ namespace Starlight.AnimeMatrix
public int XEnd(int row)
{
if (row == 0) return MaxColumns - EmptyFirstRow;
if (row <= FullEvenRows && row % 2 == 0) return MaxColumns - 1;
return MaxColumns;
}
@@ -195,20 +192,14 @@ namespace Starlight.AnimeMatrix
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
}
public int SetLedPlanar(int x, int y, byte value)
public void SetLedPlanar(int x, int y, byte value)
{
EnsureRowInRange(y);
var start = RowToLinearAddress(y) - XStart(y);
if (x >= XStart(y) && x < XEnd(y))
{
//Debug.Write((start + x).ToString("D4") + ",");
SetLedLinear(start + x, value);
return start + x;
}
//Debug.Write(" ");
return -1;
}
public void Clear(bool present = false)
@@ -276,11 +267,37 @@ namespace Starlight.AnimeMatrix
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
}
static int GetColor(Bitmap bmp, int x, int y)
public void PresentText(string text, float fontSize = 8F)
{
var pixel = bmp.GetPixel(Math.Max(0, Math.Min(bmp.Width - 1, x)), Math.Max(0, Math.Min(bmp.Height - 1, y)));
return (Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
{
using (Graphics g = Graphics.FromImage(bmp))
{
using (Font font = new Font("Arial", fontSize))
{
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
SizeF textSize = g.MeasureString(text, font);
/*
g.TranslateTransform(bmp.Width / 2, bmp.Height / 2);
g.RotateTransform(33);
g.DrawString(text, font, Brushes.White, -textSize.Width/2, -textSize.Height / 2);
*/
g.DrawString(text, font, Brushes.White, bmp.Width - textSize.Width + 5, 0);
}
}
GenerateFrame(bmp);
Present();
}
}
public void GenerateFrame(Image image)
{
@@ -288,46 +305,36 @@ namespace Starlight.AnimeMatrix
int height = MaxRows;
float scale;
Bitmap canvas = new Bitmap(width, height);
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
var graph = Graphics.FromImage(canvas);
var scaleWidth = (int)(image.Width * scale);
var scaleHeight = (int)(image.Height * scale);
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
int addr, counter = 0;
Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows);
for (int y = 0; y < bmp.Height; y++)
using (Bitmap canvas = new Bitmap(width, height))
{
for (int x = 0; x < bmp.Width; x++)
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
using (var graph = Graphics.FromImage(canvas))
{
if (x % 2 == y % 2)
{
var color = GetColor(bmp, x, y);
//var color2= GetColor(bmp, x+1, y);
addr = SetLedPlanar(x / 2, y, (byte)color);
if (addr != -1) {
if (addr != counter)
Debug.Write("ERROR");
counter++;
}
var scaleWidth = (int)(image.Width * scale);
var scaleHeight = (int)(image.Height * scale);
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
}
}
//Debug.Write("\n");
using (Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows))
{
for (int y = 0; y < bmp.Height; y++)
for (int x = 0; x < bmp.Width; x++)
if (x % 2 == y % 2)
{
var pixel = bmp.GetPixel(x, y);
SetLedPlanar(x / 2, y, (byte)((pixel.R + pixel.G + pixel.B)/3));
}
}
}
}
private void EnsureRowInRange(int row)

View File

@@ -36,7 +36,7 @@ public static class ControlHelper
foreMain = SystemColors.ControlText;
foreAccent = Color.LightGray;
borderMain = Color.LightGray;
buttonMain = SystemColors.ControlLight;
buttonMain = Color.FromArgb(255, 230, 230, 230);
}
container.BackColor = formBack;
@@ -45,6 +45,7 @@ public static class ControlHelper
_invert = invert;
AdjustControls(container.Controls);
_invert = false;
}
public static void Resize(RForm container, float baseScale = 2)
@@ -92,7 +93,7 @@ public static class ControlHelper
if (pictureBox != null && pictureBox.BackgroundImage is not null)
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
var combo = control as RComboBox;
if (combo != null)
{

View File

@@ -19,13 +19,13 @@ namespace CustomControls
[DllImport("DwmApi")] //System.Runtime.InteropServices
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
public bool darkTheme = false;
public bool darkTheme;
private static bool IsDarkTheme()
{
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
var registryValueObject = key?.GetValue("AppsUseLightTheme");
if (registryValueObject == null) return false;
return (int)registryValueObject <= 0;
}
@@ -39,8 +39,12 @@ namespace CustomControls
if (setDPI)
ControlHelper.Resize(this);
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
ControlHelper.Adjust(this, darkTheme, changed);
if (changed)
{
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
ControlHelper.Adjust(this, darkTheme, changed);
}
}
}
@@ -67,8 +71,8 @@ namespace CustomControls
}
}
}
private Color buttonColor = Color.LightGray;
[DefaultValue(typeof(Color), "LightGray")]
private Color buttonColor = Color.FromArgb(255,230, 230, 230);
[DefaultValue(typeof(Color), "230, 230, 230")]
public Color ButtonColor
{
get { return buttonColor; }
@@ -235,13 +239,18 @@ namespace CustomControls
{
//Fields
private int borderSize = 5;
private int borderRadius = 5;
private bool activated = false;
private bool secondary = false;
public int BorderRadius
{
get { return borderRadius; }
set
{
borderRadius = value;
}
}
private Color borderColor = Color.Transparent;
public Color BorderColor
{
get { return borderColor; }
@@ -252,6 +261,7 @@ namespace CustomControls
}
private bool activated = false;
public bool Activated
{
get { return activated; }
@@ -264,6 +274,7 @@ namespace CustomControls
}
}
private bool secondary = false;
public bool Secondary
{
get { return secondary; }

30
app/Fans.Designer.cs generated
View File

@@ -203,6 +203,7 @@ namespace GHelper
chartMid.Text = "chartMid";
title3.Name = "Title3";
chartMid.Titles.Add(title3);
chartMid.Visible = false;
//
// labelFans
//
@@ -231,8 +232,9 @@ namespace GHelper
//
buttonReset.Activated = false;
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonReset.BackColor = SystemColors.ControlLight;
buttonReset.BackColor = Color.FromArgb(230, 230, 230);
buttonReset.BorderColor = Color.Transparent;
buttonReset.BorderRadius = 2;
buttonReset.FlatStyle = FlatStyle.Flat;
buttonReset.Location = new Point(30, 1081);
buttonReset.Margin = new Padding(4, 2, 4, 2);
@@ -247,8 +249,9 @@ namespace GHelper
//
buttonApply.Activated = false;
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonApply.BackColor = SystemColors.ControlLight;
buttonApply.BackColor = Color.FromArgb(230, 230, 230);
buttonApply.BorderColor = Color.Transparent;
buttonApply.BorderRadius = 2;
buttonApply.FlatStyle = FlatStyle.Flat;
buttonApply.Location = new Point(542, 1081);
buttonApply.Margin = new Padding(4, 2, 4, 2);
@@ -256,7 +259,7 @@ namespace GHelper
buttonApply.Secondary = true;
buttonApply.Size = new Size(248, 44);
buttonApply.TabIndex = 14;
buttonApply.Text = "Apply Fan Curve";
buttonApply.Text = "Apply Custom Curve";
buttonApply.UseVisualStyleBackColor = false;
//
// panelPower
@@ -317,8 +320,9 @@ namespace GHelper
//
buttonApplyPower.Activated = false;
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonApplyPower.BackColor = SystemColors.ControlLight;
buttonApplyPower.BackColor = Color.FromArgb(230, 230, 230);
buttonApplyPower.BorderColor = Color.Transparent;
buttonApplyPower.BorderRadius = 2;
buttonApplyPower.FlatStyle = FlatStyle.Flat;
buttonApplyPower.Location = new Point(20, 1081);
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
@@ -342,12 +346,11 @@ namespace GHelper
//
// labelCPU
//
labelCPU.AutoSize = true;
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelCPU.Location = new Point(44, 40);
labelCPU.Location = new Point(13, 40);
labelCPU.Margin = new Padding(4, 0, 4, 0);
labelCPU.Name = "labelCPU";
labelCPU.Size = new Size(61, 32);
labelCPU.Size = new Size(120, 32);
labelCPU.TabIndex = 13;
labelCPU.Text = "CPU";
labelCPU.TextAlign = ContentAlignment.MiddleCenter;
@@ -389,25 +392,24 @@ namespace GHelper
//
// labelTotal
//
labelTotal.AutoSize = true;
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTotal.Location = new Point(46, 40);
labelTotal.Location = new Point(16, 40);
labelTotal.Margin = new Padding(4, 0, 4, 0);
labelTotal.Name = "labelTotal";
labelTotal.Size = new Size(70, 32);
labelTotal.Size = new Size(122, 32);
labelTotal.TabIndex = 12;
labelTotal.Text = "Total";
labelTotal.Text = "Platform";
labelTotal.TextAlign = ContentAlignment.MiddleCenter;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(48, 8);
label1.Location = new Point(26, 8);
label1.Margin = new Padding(4, 0, 4, 0);
label1.Name = "label1";
label1.Size = new Size(65, 32);
label1.Size = new Size(104, 32);
label1.TabIndex = 11;
label1.Text = "Total";
label1.Text = "Platform";
label1.TextAlign = ContentAlignment.MiddleCenter;
//
// trackTotal

View File

@@ -273,15 +273,16 @@ namespace GHelper
{
byte[] curve = Program.wmi.GetFanCurve(2);
if (curve.All(singleByte => singleByte == 0))
{
Program.config.setConfig("mid_fan", 0);
chartMid.Visible = false;
} else
}
else
{
Program.config.setConfig("mid_fan", 1);
chartMid.Visible = true;
SetChart(chartMid, 2);
LoadProfile(seriesMid, 2);
}
@@ -351,7 +352,7 @@ namespace GHelper
{
ApplyProfile(seriesCPU, 0);
ApplyProfile(seriesGPU, 1);
if (Program.config.getConfig("mid_fan") == 1)
if (Program.config.getConfig("mid_fan") == 1)
ApplyProfile(seriesMid, 2);
}
@@ -360,7 +361,7 @@ namespace GHelper
LoadProfile(seriesCPU, 0, 1);
LoadProfile(seriesGPU, 1, 1);
if (Program.config.getConfig("mid_fan") == 1)
if (Program.config.getConfig("mid_fan") == 1)
LoadProfile(seriesMid, 2, 1);
checkAuto.Checked = false;

View File

@@ -16,7 +16,7 @@
<PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.35</AssemblyVersion>
<AssemblyVersion>0.36</AssemblyVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -86,9 +86,5 @@ public static class HardwareMonitor
catch (Exception ex)
{
}
finally
{
Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
}
}
}

View File

@@ -56,7 +56,8 @@ namespace GHelper
ds = settingsForm.Handle;
trayIcon.MouseClick += TrayIcon_MouseClick; ;
trayIcon.MouseClick += TrayIcon_MouseClick;
wmi.SubscribeToEvents(WatcherEventArrived);
@@ -77,8 +78,15 @@ namespace GHelper
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
CheckForUpdates();
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
{
SettingsToggle();
}
Application.Run();
}

View File

@@ -68,11 +68,13 @@ namespace GHelper
buttonOptimized = new RButton();
buttonUltimate = new RButton();
panelScreen = new Panel();
labelMidFan = new Label();
labelTipScreen = new Label();
tableScreen = new TableLayoutPanel();
buttonScreenAuto = new RButton();
button60Hz = new RButton();
button120Hz = new RButton();
buttonMiniled = new RButton();
pictureScreen = new PictureBox();
labelSreen = new Label();
panelKeyboard = new Panel();
@@ -85,7 +87,6 @@ namespace GHelper
buttonKeyboardColor = new RButton();
pictureKeyboard = new PictureBox();
labelKeyboard = new Label();
buttonMiniled = new RButton();
panelMatrix.SuspendLayout();
tableLayoutMatrix.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
@@ -178,8 +179,9 @@ namespace GHelper
// buttonMatrix
//
buttonMatrix.Activated = false;
buttonMatrix.BackColor = SystemColors.ControlLight;
buttonMatrix.BackColor = Color.FromArgb(230, 230, 230);
buttonMatrix.BorderColor = Color.Transparent;
buttonMatrix.BorderRadius = 2;
buttonMatrix.Dock = DockStyle.Top;
buttonMatrix.FlatAppearance.BorderSize = 0;
buttonMatrix.FlatStyle = FlatStyle.Flat;
@@ -200,7 +202,7 @@ namespace GHelper
comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboMatrixRunning.FormattingEnabled = true;
comboMatrixRunning.ItemHeight = 32;
comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture" });
comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture", "Clock" });
comboMatrixRunning.Location = new Point(197, 10);
comboMatrixRunning.Margin = new Padding(4, 10, 4, 8);
comboMatrixRunning.Name = "comboMatrixRunning";
@@ -325,14 +327,15 @@ namespace GHelper
//
buttonQuit.Activated = false;
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonQuit.BackColor = SystemColors.ControlLight;
buttonQuit.BackColor = Color.FromArgb(230, 230, 230);
buttonQuit.BorderColor = Color.Transparent;
buttonQuit.BorderRadius = 2;
buttonQuit.FlatStyle = FlatStyle.Flat;
buttonQuit.Location = new Point(578, 16);
buttonQuit.Location = new Point(599, 16);
buttonQuit.Margin = new Padding(8, 4, 8, 4);
buttonQuit.Name = "buttonQuit";
buttonQuit.Secondary = true;
buttonQuit.Size = new Size(208, 44);
buttonQuit.Size = new Size(185, 44);
buttonQuit.TabIndex = 18;
buttonQuit.Text = "Quit";
buttonQuit.UseVisualStyleBackColor = false;
@@ -390,6 +393,7 @@ namespace GHelper
// labelCPUFan
//
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelCPUFan.Cursor = Cursors.Hand;
labelCPUFan.Location = new Point(384, 15);
labelCPUFan.Margin = new Padding(8, 0, 8, 0);
labelCPUFan.Name = "labelCPUFan";
@@ -426,6 +430,7 @@ namespace GHelper
buttonSilent.BackColor = SystemColors.ControlLightLight;
buttonSilent.BackgroundImageLayout = ImageLayout.None;
buttonSilent.BorderColor = Color.Transparent;
buttonSilent.BorderRadius = 5;
buttonSilent.CausesValidation = false;
buttonSilent.Dock = DockStyle.Fill;
buttonSilent.FlatAppearance.BorderSize = 0;
@@ -448,6 +453,7 @@ namespace GHelper
buttonBalanced.Activated = false;
buttonBalanced.BackColor = SystemColors.ControlLightLight;
buttonBalanced.BorderColor = Color.Transparent;
buttonBalanced.BorderRadius = 5;
buttonBalanced.Dock = DockStyle.Fill;
buttonBalanced.FlatAppearance.BorderSize = 0;
buttonBalanced.FlatStyle = FlatStyle.Flat;
@@ -469,6 +475,7 @@ namespace GHelper
buttonTurbo.Activated = false;
buttonTurbo.BackColor = SystemColors.ControlLightLight;
buttonTurbo.BorderColor = Color.Transparent;
buttonTurbo.BorderRadius = 5;
buttonTurbo.Dock = DockStyle.Fill;
buttonTurbo.FlatAppearance.BorderSize = 0;
buttonTurbo.FlatStyle = FlatStyle.Flat;
@@ -488,8 +495,9 @@ namespace GHelper
// buttonFans
//
buttonFans.Activated = false;
buttonFans.BackColor = SystemColors.ControlLight;
buttonFans.BackColor = Color.FromArgb(230, 230, 230);
buttonFans.BorderColor = Color.Transparent;
buttonFans.BorderRadius = 5;
buttonFans.Dock = DockStyle.Fill;
buttonFans.FlatAppearance.BorderSize = 0;
buttonFans.FlatStyle = FlatStyle.Flat;
@@ -592,6 +600,7 @@ namespace GHelper
buttonEco.Activated = false;
buttonEco.BackColor = SystemColors.ControlLightLight;
buttonEco.BorderColor = Color.Transparent;
buttonEco.BorderRadius = 5;
buttonEco.CausesValidation = false;
buttonEco.Dock = DockStyle.Top;
buttonEco.FlatAppearance.BorderSize = 0;
@@ -614,6 +623,7 @@ namespace GHelper
buttonStandard.Activated = false;
buttonStandard.BackColor = SystemColors.ControlLightLight;
buttonStandard.BorderColor = Color.Transparent;
buttonStandard.BorderRadius = 5;
buttonStandard.Dock = DockStyle.Top;
buttonStandard.FlatAppearance.BorderSize = 0;
buttonStandard.FlatStyle = FlatStyle.Flat;
@@ -635,6 +645,7 @@ namespace GHelper
buttonOptimized.Activated = false;
buttonOptimized.BackColor = SystemColors.ControlLightLight;
buttonOptimized.BorderColor = Color.Transparent;
buttonOptimized.BorderRadius = 5;
buttonOptimized.Dock = DockStyle.Top;
buttonOptimized.FlatAppearance.BorderSize = 0;
buttonOptimized.FlatStyle = FlatStyle.Flat;
@@ -656,6 +667,7 @@ namespace GHelper
buttonUltimate.Activated = false;
buttonUltimate.BackColor = SystemColors.ControlLightLight;
buttonUltimate.BorderColor = Color.Transparent;
buttonUltimate.BorderRadius = 5;
buttonUltimate.Dock = DockStyle.Top;
buttonUltimate.FlatAppearance.BorderSize = 0;
buttonUltimate.FlatStyle = FlatStyle.Flat;
@@ -676,6 +688,7 @@ namespace GHelper
//
panelScreen.AutoSize = true;
panelScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelScreen.Controls.Add(labelMidFan);
panelScreen.Controls.Add(labelTipScreen);
panelScreen.Controls.Add(tableScreen);
panelScreen.Controls.Add(pictureScreen);
@@ -688,6 +701,17 @@ namespace GHelper
panelScreen.Size = new Size(810, 181);
panelScreen.TabIndex = 38;
//
// labelMidFan
//
labelMidFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelMidFan.Location = new Point(488, 13);
labelMidFan.Margin = new Padding(8, 0, 8, 0);
labelMidFan.Name = "labelMidFan";
labelMidFan.Size = new Size(296, 34);
labelMidFan.TabIndex = 25;
labelMidFan.Text = " ";
labelMidFan.TextAlign = ContentAlignment.TopRight;
//
// labelTipScreen
//
labelTipScreen.ForeColor = SystemColors.GrayText;
@@ -711,7 +735,6 @@ namespace GHelper
tableScreen.Controls.Add(button60Hz, 1, 0);
tableScreen.Controls.Add(button120Hz, 2, 0);
tableScreen.Controls.Add(buttonMiniled, 3, 0);
tableScreen.Location = new Point(16, 51);
tableScreen.Margin = new Padding(8, 4, 8, 4);
tableScreen.Name = "tableScreen";
@@ -725,6 +748,7 @@ namespace GHelper
buttonScreenAuto.Activated = false;
buttonScreenAuto.BackColor = SystemColors.ControlLightLight;
buttonScreenAuto.BorderColor = Color.Transparent;
buttonScreenAuto.BorderRadius = 5;
buttonScreenAuto.Dock = DockStyle.Fill;
buttonScreenAuto.FlatAppearance.BorderSize = 0;
buttonScreenAuto.FlatStyle = FlatStyle.Flat;
@@ -743,6 +767,7 @@ namespace GHelper
button60Hz.Activated = false;
button60Hz.BackColor = SystemColors.ControlLightLight;
button60Hz.BorderColor = Color.Transparent;
button60Hz.BorderRadius = 5;
button60Hz.CausesValidation = false;
button60Hz.Dock = DockStyle.Fill;
button60Hz.FlatAppearance.BorderSize = 0;
@@ -762,6 +787,7 @@ namespace GHelper
button120Hz.Activated = false;
button120Hz.BackColor = SystemColors.ControlLightLight;
button120Hz.BorderColor = Color.Transparent;
button120Hz.BorderRadius = 5;
button120Hz.Dock = DockStyle.Fill;
button120Hz.FlatAppearance.BorderSize = 0;
button120Hz.FlatStyle = FlatStyle.Flat;
@@ -775,6 +801,26 @@ namespace GHelper
button120Hz.Text = "120Hz + OD";
button120Hz.UseVisualStyleBackColor = false;
//
// buttonMiniled
//
buttonMiniled.Activated = false;
buttonMiniled.BackColor = SystemColors.ControlLightLight;
buttonMiniled.BorderColor = Color.Transparent;
buttonMiniled.BorderRadius = 5;
buttonMiniled.CausesValidation = false;
buttonMiniled.Dock = DockStyle.Fill;
buttonMiniled.FlatAppearance.BorderSize = 0;
buttonMiniled.FlatStyle = FlatStyle.Flat;
buttonMiniled.ForeColor = SystemColors.ControlText;
buttonMiniled.Location = new Point(583, 4);
buttonMiniled.Margin = new Padding(4);
buttonMiniled.Name = "buttonMiniled";
buttonMiniled.Secondary = false;
buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled";
buttonMiniled.UseVisualStyleBackColor = false;
//
// pictureScreen
//
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
@@ -836,8 +882,9 @@ namespace GHelper
// buttonKeyboard
//
buttonKeyboard.Activated = false;
buttonKeyboard.BackColor = SystemColors.ControlLight;
buttonKeyboard.BackColor = Color.FromArgb(230, 230, 230);
buttonKeyboard.BorderColor = Color.Transparent;
buttonKeyboard.BorderRadius = 2;
buttonKeyboard.Dock = DockStyle.Top;
buttonKeyboard.FlatAppearance.BorderSize = 0;
buttonKeyboard.FlatStyle = FlatStyle.Flat;
@@ -905,6 +952,7 @@ namespace GHelper
buttonKeyboardColor.Activated = false;
buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight;
buttonKeyboardColor.BorderColor = Color.Transparent;
buttonKeyboardColor.BorderRadius = 2;
buttonKeyboardColor.Dock = DockStyle.Top;
buttonKeyboardColor.FlatStyle = FlatStyle.Flat;
buttonKeyboardColor.ForeColor = SystemColors.ControlText;
@@ -939,25 +987,6 @@ namespace GHelper
labelKeyboard.TabIndex = 32;
labelKeyboard.Text = "Laptop Keyboard";
//
// buttonMiniled
//
buttonMiniled.Activated = false;
buttonMiniled.BackColor = SystemColors.ControlLightLight;
buttonMiniled.BorderColor = Color.Transparent;
buttonMiniled.CausesValidation = false;
buttonMiniled.Dock = DockStyle.Fill;
buttonMiniled.FlatAppearance.BorderSize = 0;
buttonMiniled.FlatStyle = FlatStyle.Flat;
buttonMiniled.ForeColor = SystemColors.ControlText;
buttonMiniled.Location = new Point(197, 4);
buttonMiniled.Margin = new Padding(4);
buttonMiniled.Name = "buttonMiniled";
buttonMiniled.Secondary = false;
buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled";
buttonMiniled.UseVisualStyleBackColor = false;
//
// SettingsForm
//
AutoScaleDimensions = new SizeF(192F, 192F);
@@ -1073,5 +1102,6 @@ namespace GHelper
private RButton buttonKeyboard;
private RButton buttonKeyboardColor;
private RButton buttonFans;
private Label labelMidFan;
}
}

View File

@@ -10,7 +10,9 @@ namespace GHelper
public partial class SettingsForm : RForm
{
static System.Timers.Timer aTimer = default!;
public static System.Timers.Timer aTimer = default!;
public static Point trayPoint;
static System.Timers.Timer matrixTimer = default!;
public string versionUrl = "http://github.com/seerge/g-helper/releases";
@@ -21,6 +23,7 @@ namespace GHelper
public Keyboard keyb;
static AnimeMatrixDevice mat;
static long lastTip;
public SettingsForm()
{
@@ -114,12 +117,29 @@ namespace GHelper
button120Hz.MouseMove += Button120Hz_MouseHover;
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
SetTimer();
aTimer = new System.Timers.Timer(500);
aTimer.Elapsed += OnTimedEvent;
}
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
{
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTip) < 2000) return;
lastTip = DateTimeOffset.Now.ToUnixTimeMilliseconds();
RefreshSensors();
}
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
aTimer.Interval = 2000;
if (Program.settingsForm.Visible)
RefreshSensors();
}
private void Button120Hz_MouseHover(object? sender, EventArgs e)
{
@@ -252,8 +272,9 @@ namespace GHelper
Program.config.setConfig("matrix_auto", check.Checked ? 1 : 0);
}
private static void StartMatrixTimer()
private static void StartMatrixTimer(int interval = 100)
{
matrixTimer.Interval = interval;
matrixTimer.Enabled = true;
}
@@ -265,14 +286,23 @@ namespace GHelper
private static void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e)
{
if (mat is null) return;
mat.PresentNextFrame();
switch (Program.config.getConfig("matrix_running"))
{
case 2:
mat.PresentNextFrame();
break;
case 3:
mat.PresentText(DateTime.Now.ToString("H:mm:ss"));
break;
}
}
void SetMatrixPicture(string fileName)
{
if (mat is null) return;
StopMatrixTimer();
Image image;
@@ -315,8 +345,6 @@ namespace GHelper
mat.GenerateFrame(image);
mat.Present();
}
}
@@ -342,6 +370,8 @@ namespace GHelper
if (fileName is not null)
{
Program.config.setConfig("matrix_picture", fileName);
Program.config.setConfig("matrix_running", 2);
SetMatrixPicture(fileName);
BeginInvoke(delegate
{
@@ -397,14 +427,19 @@ namespace GHelper
mat.SetDisplayState(true);
mat.SetBrightness((BrightnessMode)brightness);
if (running == 2)
switch (running)
{
string fileName = Program.config.getConfigString("matrix_picture");
SetMatrixPicture(fileName);
}
else
{
mat.SetBuiltInAnimation(true, animation);
case 2:
SetMatrixPicture(Program.config.getConfigString("matrix_picture"));
break;
case 3:
mat.SetBuiltInAnimation(false);
StartMatrixTimer(1000);
break;
default:
mat.SetBuiltInAnimation(true, animation);
break;
}
}
@@ -532,7 +567,7 @@ namespace GHelper
int brightness = Program.config.getConfig("matrix_brightness");
int running = Program.config.getConfig("matrix_running");
comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count-1) : 0;
comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count - 1) : 0;
comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0;
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
@@ -707,7 +742,8 @@ namespace GHelper
{
buttonMiniled.Activated = (miniled == 1);
Program.config.setConfig("miniled", miniled);
} else
}
else
{
buttonMiniled.Visible = false;
}
@@ -747,17 +783,11 @@ namespace GHelper
SetGPUMode(ASUSWmi.GPUModeEco);
}
private static void SetTimer()
{
aTimer = new System.Timers.Timer(500);
aTimer.Elapsed += OnTimedEvent;
aTimer.AutoReset = true;
aTimer.Enabled = false;
}
private static string FormatFan(int fan)
{
if (fan < 0) return null;
if (Program.config.getConfig("fan_rpm") == 1)
return " Fan: " + (fan * 100).ToString() + "RPM";
else
@@ -769,6 +799,7 @@ namespace GHelper
string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
string midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
string cpuTemp = "";
string gpuTemp = "";
@@ -791,15 +822,14 @@ namespace GHelper
{
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
if (midFan is not null) Program.settingsForm.labelMidFan.Text = "Mid" + midFan;
Program.settingsForm.labelBattery.Text = battery;
Program.trayIcon.Text = "CPU" + cpuTemp + cpuFan + "\n" + "GPU" + gpuTemp + gpuFan + ((battery.Length > 0) ? ("\n" + battery) : "");
});
}
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
RefreshSensors();
aTimer.Interval = 2000;
}
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
{
@@ -996,12 +1026,6 @@ namespace GHelper
if (!ultimate)
{
tableGPU.Controls.Remove(buttonUltimate);
/*
* buttonFans.Image = null;
buttonFans.Height = 44;
*/
tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0;
tableScreen.ColumnCount = 0;

View File

@@ -53,14 +53,14 @@ PPTs are shown for G14 2022, for other models PPTs will be different as they are
### :video_game: GPU Modes
1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display
2. Standard mode (Windows Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
2. Standard mode (MS Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model)
4. Optimized (formely existed as a checkbox): disables dGPU on battery (Eco) and enables when plugged (Standard)
### :question: FAQ
#### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
Go to BIOS (F2 on boot), open Advanced Settings (F8) and disable "Armory Control Intrerface"
Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Intrerface"
#### Why Ultimate GPU mode is not available on my laptop?
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
@@ -68,6 +68,9 @@ Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other mo
#### App doesn't start / or crashes, what should I do ?
Open "Event Viewer" from start menu, go to Windows Logs -> Application and check for recent Errors mentioning G-Helper. If you see one - please post a [new issue](https://github.com/seerge/g-helper/issues) with all details from this error.
#### How do I uninstall G-helper?
G-helper is a single exe, and it doesn't install anything in the system. To remove it - you can simply delete exe :) If you have applied any custom fan profiles or PPTs - before removing I would recommend selecting your favorite perfromance mode (for example balanced) and clicking "Factory defaults" under Fans + Power.
----------------------------
### How to install