Compare commits

..

4 Commits

Author SHA1 Message Date
seerge
f4d066d407 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-02-19 21:52:04 +01:00
seerge
cc96ca9946 Supressed crash on failed battery charge limit setting 2023-02-19 21:52:01 +01:00
seerge
fb95d9abb2 Update README.md 2023-02-19 21:06:22 +01:00
seerge
15112cb5c8 Added cycling through aura modes by FN+F4 2023-02-19 19:40:49 +01:00
5 changed files with 119 additions and 57 deletions

View File

@@ -429,11 +429,10 @@ public class Aura
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
public const int Static = 0;
public const int Breathe = 0;
public const int Strobe = 0;
public const int Rainbow = 0;
public const int Breathe = 1;
public const int Strobe = 2;
public const int Rainbow = 3;
public const int SpeedSlow = 0;
public const int SpeedMedium = 1;
public const int SpeedHigh = 2;
@@ -559,6 +558,12 @@ namespace GHelper
settingsForm.CyclePerformanceMode();
});
return;
case 179: // FN+F4
settingsForm.BeginInvoke(delegate
{
settingsForm.CycleAuraMode();
});
return;
case 87: // Battery
settingsForm.BeginInvoke(delegate
{
@@ -591,6 +596,8 @@ namespace GHelper
settingsForm.Show();
settingsForm.Activate();
}
trayIcon.Icon = trayIcon.Icon; // refreshing icon as it get's blurred when screen resolution changes
}
}

View File

@@ -22,18 +22,18 @@ Profiles are **same** as in Armory Crate, including default fan curves
## Extras
1. **Maximum battery charge rate** limit (60% / 80% / 100%) to preserve your battery
2. CPU and GPU relative fan speed monitoring
3. Automatic switching of Standard/Eco GPU modes when laptop is plugged / unplugged!
4. FN+F5 an M4 (Rog) keys cycle through Performance modes
5. Screen resolution and display overdrive switching
6. Run on startup (optional)
1. Keyboard backlight control (basic aura modes and colors)
2. **Maximum battery charge rate** limit (60% / 80% / 100%) to preserve your battery
3. CPU and GPU relative fan speed monitoring
4. Automatic switching of Standard/Eco GPU modes when laptop is plugged / unplugged!
5. FN+F5 an M4 (Rog) keys cycle through Performance modes
6. Screen resolution and display overdrive switching
7. Run on startup (optional)
## Things still missing
1. Keyboard backlight control
2. Custom fan profiles
3. Anime matrix control
1. Custom fan profiles
2. Anime matrix control
## How to install

22
Settings.Designer.cs generated
View File

@@ -61,6 +61,7 @@
this.label1 = new System.Windows.Forms.Label();
this.comboKeyboard = new System.Windows.Forms.ComboBox();
this.buttonKeyboardColor = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
this.tableGPU.SuspendLayout();
@@ -70,6 +71,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).BeginInit();
this.tableScreen.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// checkStartup
@@ -482,10 +484,11 @@
"Breathe",
"Strobe",
"Rainbow"});
this.comboKeyboard.Location = new System.Drawing.Point(31, 778);
this.comboKeyboard.Location = new System.Drawing.Point(40, 778);
this.comboKeyboard.Name = "comboKeyboard";
this.comboKeyboard.Size = new System.Drawing.Size(212, 40);
this.comboKeyboard.Size = new System.Drawing.Size(198, 40);
this.comboKeyboard.TabIndex = 24;
this.comboKeyboard.TabStop = false;
//
// buttonKeyboardColor
//
@@ -497,11 +500,19 @@
this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773);
this.buttonKeyboardColor.Margin = new System.Windows.Forms.Padding(0);
this.buttonKeyboardColor.Name = "buttonKeyboardColor";
this.buttonKeyboardColor.Size = new System.Drawing.Size(212, 49);
this.buttonKeyboardColor.Size = new System.Drawing.Size(212, 50);
this.buttonKeyboardColor.TabIndex = 25;
this.buttonKeyboardColor.Text = "Color";
this.buttonKeyboardColor.UseVisualStyleBackColor = false;
this.buttonKeyboardColor.Click += new System.EventHandler(this.buttonKeyboard_Click);
//
// pictureBox2
//
this.pictureBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.pictureBox2.Location = new System.Drawing.Point(32, 773);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(212, 50);
this.pictureBox2.TabIndex = 26;
this.pictureBox2.TabStop = false;
//
// SettingsForm
//
@@ -532,6 +543,7 @@
this.Controls.Add(this.labelBattery);
this.Controls.Add(this.trackBattery);
this.Controls.Add(this.checkStartup);
this.Controls.Add(this.pictureBox2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.MaximizeBox = false;
@@ -553,6 +565,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).EndInit();
this.tableScreen.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -591,5 +604,6 @@
private Label label1;
private ComboBox comboKeyboard;
private Button buttonKeyboardColor;
private PictureBox pictureBox2;
}
}

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
using Microsoft.VisualBasic.ApplicationServices;
using System.Diagnostics;
using System.Management;
using System.Timers;
using System.Windows.Forms;
@@ -55,42 +56,16 @@ namespace GHelper
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
comboKeyboard.SelectedIndex = 0;
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
buttonKeyboardColor.Click += ButtonKeyboardColor_Click;
SetTimer();
}
public void InitAura()
{
int mode = Program.config.getConfig("aura_mode");
int color = Program.config.getConfig("aura_color");
int speed = Program.config.getConfig("aura_speed");
if (mode == -1) mode = 0;
if (color == -1) color = Color.FromArgb(255, 255, 255).ToArgb();
Aura.Mode = mode;
Aura.Color1 = Color.FromArgb(color);
comboKeyboard.SelectedIndex = Aura.Mode;
buttonKeyboardColor.FlatAppearance.BorderColor = Aura.Color1;
}
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
{
ComboBox cmb = (ComboBox)sender;
int selectedIndex = cmb.SelectedIndex;
Aura.Mode = (byte)selectedIndex;
Aura.ApplyAura();
Program.config.setConfig("aura_mode", selectedIndex);
}
private void buttonKeyboard_Click(object sender, EventArgs e)
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
{
Button but = (Button)sender;
@@ -101,13 +76,72 @@ namespace GHelper
if (colorDlg.ShowDialog() == DialogResult.OK)
{
but.FlatAppearance.BorderColor = colorDlg.Color;
Aura.Color1 = colorDlg.Color;
Aura.ApplyAura();
Program.config.setConfig("aura_color", colorDlg.Color.ToArgb());
SetAuraColor(colorDlg.Color);
}
}
public void InitAura()
{
int mode = Program.config.getConfig("aura_mode");
int colorCode = Program.config.getConfig("aura_color");
int speed = Program.config.getConfig("aura_speed");
Color color = Color.FromArgb(255, 255, 255);
if (mode == -1)
mode = 0;
if (colorCode != -1)
color = Color.FromArgb(colorCode);
SetAuraColor(color, false);
SetAuraMode(mode, false);
Aura.Mode = mode;
}
public void SetAuraColor(Color color, bool apply = true)
{
Aura.Color1 = color;
Program.config.setConfig("aura_color", color.ToArgb());
if (apply)
Aura.ApplyAura();
buttonKeyboardColor.FlatAppearance.BorderColor = color;
}
public void SetAuraMode (int mode = 0, bool apply = true)
{
if (mode > 3) mode = 0;
if (Aura.Mode == mode) return; // same mode
Aura.Mode = mode;
Program.config.setConfig("aura_mode", mode);
if (apply)
Aura.ApplyAura();
else
comboKeyboard.SelectedIndex = mode;
}
public void CycleAuraMode ()
{
SetAuraMode(Program.config.getConfig("aura_mode") + 1);
}
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
{
ComboBox cmb = (ComboBox)sender;
SetAuraMode(cmb.SelectedIndex);
}
private void CheckBoost_Click(object? sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
@@ -538,7 +572,13 @@ namespace GHelper
labelBatteryLimit.Text = limit.ToString() + "%";
trackBattery.Value = limit;
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
try
{
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
} catch
{
Debug.WriteLine("Can't set battery charge limit");
}
Program.config.setConfig("charge_limit", limit);
}
@@ -568,6 +608,7 @@ namespace GHelper
Program.config.setConfig("screen_auto", 0);
}
}

View File

@@ -61,7 +61,7 @@
<data name="pictureBattery.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAAY1JREFUaEPtlz1OAzEQhVdIFFyCH0EFDQ1wAhDcgxPACYCOA/BzGTo6aKGKFOAE
DAAACwwBP0AiyAAAAY1JREFUaEPtlz1OAzEQhVdIFFyCH0EFDQ1wAhDcgxPACYCOA/BzGTo6aKGKFOAE
0FCABO9FsbSK3uI8J9kFMZ/0FdmMZ+xovLGrIAiCIAiCQLIMr+EL/IRfM5Y1WOsKsvZE7ME3qAq1IWvv
wiJWYJeTT77CJWjDtlEJu/AS2rAPVbIufII2bWzYceVcbFQix1V4CKe1j2xUEscEN+ANVDGONiqJY505
eATfoYp15N48gFnUYEfFOryDKt7xGWZRA0flhHbgOewNnyWbmIcn8APW412zqEGj8u9+ASY24Rl8GHz6
@@ -74,7 +74,7 @@
<data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
DAAACwwBP0AiyAAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k
vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k
d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar
@@ -87,7 +87,7 @@
<data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAA31JREFUaEPt2NnrTkEcx/HHmj37hTWJP0BCSe5ESSnklivJUsiuXFiSIlsS98qW
DAAACwwBP0AiyAAAA31JREFUaEPt2NnrTkEcx/HHmj37hTWJP0BCSe5ESSnklivJUsiuXFiSIlsS98qW
CLmTP0FKUkqkrNn37f2p39T07fucmfM85/eQzqdexW/mzJlzzpyZeU6jTp06df6L9MQsbMdF3MVrfOui
f+tvF7ANM6Fj/nrGYT+e4HdJj7EPY9HxjMBJfIXXuTK+4ASGoyNZjpfwOtOOF1iGbktv6K57J6/Scehc
laY/rsI7YfADt7EReqFHow8GYCJmYzNu4ju8NoIr0Dkrie5GUec/4QDU4dzMh9dWTBdRyZMoGjbnMR5l
@@ -108,7 +108,7 @@
<data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAANBJREFUaEPt2DESAUEUhOF1PQQuxd1wHAGi1U8galU9ktej+qv6M71myyZriYiI
DAAACwwBP0AiyAAAANBJREFUaEPt2DESAUEUhOF1PQQuxd1wHAGi1U8galU9ktej+qv6M71myyZriYiI
+Fd7dEFPtDZV311n2KEhdXh2wc4OSHZF7CKdnZGs87H51gPJ2AUckrGxQzI2dkjGxg7J2NghGRs7JGNj
h2Rs7JCMjR2SsbFDMjZ2SMbGDsnY2CEZGzskY2OHZGzskIyNHZKxsUOy6V8pp3+pr/9h2EU626IhdRN1
191/bNUZhg8fMeiE7og9h47VWY/obYNuiH3QuTrzR93NtL9ARET8aFleMDJURjd/4/oAAAAASUVORK5C