mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added option to keep dGPU off on usb-c
This commit is contained in:
@@ -14,6 +14,11 @@ public class ASUSWmi
|
|||||||
public const int KB_Light_Up = 0xc4;
|
public const int KB_Light_Up = 0xc4;
|
||||||
public const int KB_Light_Down = 0xc5;
|
public const int KB_Light_Down = 0xc5;
|
||||||
|
|
||||||
|
public const int ChargerMode = 0x0012006C;
|
||||||
|
|
||||||
|
public const int ChargerUSB = 2;
|
||||||
|
public const int ChargerBarrel = 1;
|
||||||
|
|
||||||
public const uint CPU_Fan = 0x00110013;
|
public const uint CPU_Fan = 0x00110013;
|
||||||
public const uint GPU_Fan = 0x00110014;
|
public const uint GPU_Fan = 0x00110014;
|
||||||
public const uint Mid_Fan = 0x00110031;
|
public const uint Mid_Fan = 0x00110031;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ using System.Drawing.Drawing2D;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using OSD;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
{
|
{
|
||||||
@@ -107,9 +110,6 @@ namespace Starlight.AnimeMatrix
|
|||||||
MaxColumns = 33;
|
MaxColumns = 33;
|
||||||
dx = 1;
|
dx = 1;
|
||||||
|
|
||||||
//FullRows = 7;
|
|
||||||
//FullEvenRows = 3;
|
|
||||||
|
|
||||||
MaxRows = 55;
|
MaxRows = 55;
|
||||||
LedCount = 1245;
|
LedCount = 1245;
|
||||||
|
|
||||||
@@ -177,17 +177,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
return (y + 1) / 2 - 3;
|
return (y + 1) / 2 - 3;
|
||||||
}
|
}
|
||||||
case AnimeType.GA402:
|
|
||||||
if (y < 11)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (y) / 2 - 5;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Invalid anime type", nameof(_model));
|
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,10 +188,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
case AnimeType.GA401:
|
case AnimeType.GA401:
|
||||||
return 33;
|
return 33;
|
||||||
case AnimeType.GA402:
|
|
||||||
return 34;
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Invalid anime type", nameof(_model));
|
return 34;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,36 +210,15 @@ namespace Starlight.AnimeMatrix
|
|||||||
default:
|
default:
|
||||||
return 36 - y / 2;
|
return 36 - y / 2;
|
||||||
}
|
}
|
||||||
case AnimeType.GA402:
|
|
||||||
return Width(y) - FirstX(y);
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Invalid anime type", nameof(_model));
|
return Width(y) - FirstX(y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public int XStart(int row)
|
|
||||||
{
|
|
||||||
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int XEnd(int row)
|
|
||||||
{
|
|
||||||
if (row <= FullEvenRows)
|
|
||||||
{
|
|
||||||
if (row % 2 == 1) return MaxColumns + 2;
|
|
||||||
else return MaxColumns;
|
|
||||||
}
|
|
||||||
return MaxColumns;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public int RowToLinearAddress(int y)
|
public int RowToLinearAddress(int y)
|
||||||
{
|
{
|
||||||
EnsureRowInRange(y);
|
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
for (var i = 0; i < y; i++)
|
for (var i = 0; i < y; i++)
|
||||||
ret += Pitch(i);
|
ret += Pitch(i);
|
||||||
|
|
||||||
@@ -259,13 +227,10 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public void SetLedPlanar(int x, int y, byte value)
|
public void SetLedPlanar(int x, int y, byte value)
|
||||||
{
|
{
|
||||||
EnsureRowInRange(y);
|
if (!IsRowInRange(y)) return;
|
||||||
|
|
||||||
if (x >= FirstX(y) && x < Width(y))
|
if (x >= FirstX(y) && x < Width(y))
|
||||||
{
|
|
||||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
||||||
//Debug.Write((RowToLinearAddress(y) - FirstX(y) + x + dx).ToString() + " ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WakeUp()
|
public void WakeUp()
|
||||||
@@ -366,9 +331,9 @@ namespace Starlight.AnimeMatrix
|
|||||||
int second = DateTime.Now.Second;
|
int second = DateTime.Now.Second;
|
||||||
|
|
||||||
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
||||||
PresentText(DateTime.Now.ToString("H" + ((second % 2 == 0)?":":" ") + "mm"));
|
PresentTextDiagonal(DateTime.Now.ToString("H" + ((second % 2 == 0)?":":" ") + "mm"));
|
||||||
else
|
else
|
||||||
PresentText(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mm"), DateTime.Now.ToString("tt"));
|
PresentTextDiagonal(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PresentText(string text1, string text2 = "")
|
public void PresentText(string text1, string text2 = "")
|
||||||
@@ -442,12 +407,52 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnsureRowInRange(int row)
|
|
||||||
|
public void SetLedDiagonal(int x, int y, byte color, int delta = 10)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= MaxRows)
|
//x+=delta;
|
||||||
|
y-=delta;
|
||||||
|
|
||||||
|
int dx = (x - y)/2;
|
||||||
|
int dy = x + y;
|
||||||
|
SetLedPlanar(dx, dy, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PresentTextDiagonal(string text)
|
||||||
|
{
|
||||||
|
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
||||||
|
|
||||||
|
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
||||||
{
|
{
|
||||||
throw new IndexOutOfRangeException($"Y-coordinate should fall in range of [0, {MaxRows - 1}].");
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
|
using (Font font = new Font("Calibri", 16F, GraphicsUnit.Pixel))
|
||||||
|
{
|
||||||
|
SizeF textSize = g.MeasureString(text, font);
|
||||||
|
g.DrawString(text, font, Brushes.White, 4, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
|
{
|
||||||
|
var pixel = bmp.GetPixel(x, y);
|
||||||
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
|
SetLedDiagonal(x, y, (byte)color);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Present();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsRowInRange(int row)
|
||||||
|
{
|
||||||
|
return (row >= 0 && row < MaxRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsAddressableLed(int address)
|
private bool IsAddressableLed(int address)
|
||||||
|
|||||||
114
app/Keyboard.Designer.cs → app/Extra.Designer.cs
generated
114
app/Keyboard.Designer.cs → app/Extra.Designer.cs
generated
@@ -3,7 +3,7 @@ using GHelper.Properties;
|
|||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
partial class Keyboard
|
partial class Extra
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -31,7 +31,7 @@ namespace GHelper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
groupBox1 = new GroupBox();
|
groupBindings = new GroupBox();
|
||||||
pictureHelp = new PictureBox();
|
pictureHelp = new PictureBox();
|
||||||
textFNF4 = new TextBox();
|
textFNF4 = new TextBox();
|
||||||
comboFNF4 = new RComboBox();
|
comboFNF4 = new RComboBox();
|
||||||
@@ -52,39 +52,40 @@ namespace GHelper
|
|||||||
checkBoot = new CheckBox();
|
checkBoot = new CheckBox();
|
||||||
checkAwake = new CheckBox();
|
checkAwake = new CheckBox();
|
||||||
groupOther = new GroupBox();
|
groupOther = new GroupBox();
|
||||||
|
checkUSBC = new CheckBox();
|
||||||
checkNoOverdrive = new CheckBox();
|
checkNoOverdrive = new CheckBox();
|
||||||
checkKeyboardAuto = new CheckBox();
|
checkKeyboardAuto = new CheckBox();
|
||||||
checkTopmost = new CheckBox();
|
checkTopmost = new CheckBox();
|
||||||
groupBox1.SuspendLayout();
|
groupBindings.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
||||||
groupLight.SuspendLayout();
|
groupLight.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
||||||
groupOther.SuspendLayout();
|
groupOther.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBindings
|
||||||
//
|
//
|
||||||
groupBox1.Controls.Add(pictureHelp);
|
groupBindings.Controls.Add(pictureHelp);
|
||||||
groupBox1.Controls.Add(textFNF4);
|
groupBindings.Controls.Add(textFNF4);
|
||||||
groupBox1.Controls.Add(comboFNF4);
|
groupBindings.Controls.Add(comboFNF4);
|
||||||
groupBox1.Controls.Add(labelFNF4);
|
groupBindings.Controls.Add(labelFNF4);
|
||||||
groupBox1.Controls.Add(textM4);
|
groupBindings.Controls.Add(textM4);
|
||||||
groupBox1.Controls.Add(textM3);
|
groupBindings.Controls.Add(textM3);
|
||||||
groupBox1.Controls.Add(comboM4);
|
groupBindings.Controls.Add(comboM4);
|
||||||
groupBox1.Controls.Add(labelM4);
|
groupBindings.Controls.Add(labelM4);
|
||||||
groupBox1.Controls.Add(comboM3);
|
groupBindings.Controls.Add(comboM3);
|
||||||
groupBox1.Controls.Add(labelM3);
|
groupBindings.Controls.Add(labelM3);
|
||||||
groupBox1.Dock = DockStyle.Top;
|
groupBindings.Dock = DockStyle.Top;
|
||||||
groupBox1.Location = new Point(10, 10);
|
groupBindings.Location = new Point(10, 10);
|
||||||
groupBox1.Name = "groupBox1";
|
groupBindings.Name = "groupBindings";
|
||||||
groupBox1.Size = new Size(840, 242);
|
groupBindings.Size = new Size(844, 242);
|
||||||
groupBox1.TabIndex = 0;
|
groupBindings.TabIndex = 0;
|
||||||
groupBox1.TabStop = false;
|
groupBindings.TabStop = false;
|
||||||
groupBox1.Text = Properties.Strings.KeyBindings;
|
groupBindings.Text = "Key Bindings";
|
||||||
//
|
//
|
||||||
// pictureHelp
|
// pictureHelp
|
||||||
//
|
//
|
||||||
pictureHelp.BackgroundImage = Properties.Resources.icons8_help_64;
|
pictureHelp.BackgroundImage = Resources.icons8_help_64;
|
||||||
pictureHelp.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureHelp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureHelp.Cursor = Cursors.Hand;
|
pictureHelp.Cursor = Cursors.Hand;
|
||||||
pictureHelp.Location = new Point(744, 57);
|
pictureHelp.Location = new Point(744, 57);
|
||||||
@@ -141,7 +142,7 @@ namespace GHelper
|
|||||||
comboM4.BorderColor = Color.White;
|
comboM4.BorderColor = Color.White;
|
||||||
comboM4.ButtonColor = Color.FromArgb(255, 255, 255);
|
comboM4.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
comboM4.FormattingEnabled = true;
|
comboM4.FormattingEnabled = true;
|
||||||
comboM4.Items.AddRange(new object[] { Properties.Strings.PerformanceMode, Properties.Strings.OpenGHelper, Properties.Strings.Custom });
|
comboM4.Items.AddRange(new object[] { Strings.PerformanceMode, Strings.OpenGHelper, Strings.Custom });
|
||||||
comboM4.Location = new Point(93, 112);
|
comboM4.Location = new Point(93, 112);
|
||||||
comboM4.Name = "comboM4";
|
comboM4.Name = "comboM4";
|
||||||
comboM4.Size = new Size(312, 40);
|
comboM4.Size = new Size(312, 40);
|
||||||
@@ -161,7 +162,7 @@ namespace GHelper
|
|||||||
comboM3.BorderColor = Color.White;
|
comboM3.BorderColor = Color.White;
|
||||||
comboM3.ButtonColor = Color.FromArgb(255, 255, 255);
|
comboM3.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
comboM3.FormattingEnabled = true;
|
comboM3.FormattingEnabled = true;
|
||||||
comboM3.Items.AddRange(new object[] { Properties.Strings.Default, Properties.Strings.VolumeMute, Properties.Strings.PlayPause, Properties.Strings.PrintScreen, Properties.Strings.ToggleAura, Properties.Strings.Custom });
|
comboM3.Items.AddRange(new object[] { Strings.Default, Strings.VolumeMute, Strings.PlayPause, Strings.PrintScreen, Strings.ToggleAura, Strings.Custom });
|
||||||
comboM3.Location = new Point(93, 54);
|
comboM3.Location = new Point(93, 54);
|
||||||
comboM3.Name = "comboM3";
|
comboM3.Name = "comboM3";
|
||||||
comboM3.Size = new Size(312, 40);
|
comboM3.Size = new Size(312, 40);
|
||||||
@@ -189,11 +190,10 @@ namespace GHelper
|
|||||||
groupLight.Dock = DockStyle.Top;
|
groupLight.Dock = DockStyle.Top;
|
||||||
groupLight.Location = new Point(10, 252);
|
groupLight.Location = new Point(10, 252);
|
||||||
groupLight.Name = "groupLight";
|
groupLight.Name = "groupLight";
|
||||||
groupLight.Size = new Size(840, 395);
|
groupLight.Size = new Size(844, 395);
|
||||||
groupLight.TabIndex = 1;
|
groupLight.TabIndex = 1;
|
||||||
groupLight.TabStop = false;
|
groupLight.TabStop = false;
|
||||||
groupLight.Text = Properties.Strings.KeyboardBacklight;
|
groupLight.Text = "Keyboard Backlight";
|
||||||
//groupLight.AutoSize = true;
|
|
||||||
//
|
//
|
||||||
// labelBrightness
|
// labelBrightness
|
||||||
//
|
//
|
||||||
@@ -201,16 +201,16 @@ namespace GHelper
|
|||||||
labelBrightness.Name = "labelBrightness";
|
labelBrightness.Name = "labelBrightness";
|
||||||
labelBrightness.Size = new Size(197, 49);
|
labelBrightness.Size = new Size(197, 49);
|
||||||
labelBrightness.TabIndex = 0;
|
labelBrightness.TabIndex = 0;
|
||||||
labelBrightness.Text = Properties.Strings.Brightness;
|
labelBrightness.Text = "Brightness";
|
||||||
//
|
//
|
||||||
// trackBrightness
|
// trackBrightness
|
||||||
//
|
//
|
||||||
trackBrightness.Location = new Point(228, 294);
|
trackBrightness.Location = new Point(228, 294);
|
||||||
trackBrightness.Name = "trackBrightness";
|
|
||||||
trackBrightness.Size = new Size(600, 30);
|
|
||||||
trackBrightness.TabIndex = 1;
|
|
||||||
trackBrightness.Minimum = 0;
|
|
||||||
trackBrightness.Maximum = 3;
|
trackBrightness.Maximum = 3;
|
||||||
|
trackBrightness.Name = "trackBrightness";
|
||||||
|
trackBrightness.Size = new Size(600, 90);
|
||||||
|
trackBrightness.TabIndex = 1;
|
||||||
|
trackBrightness.TickStyle = TickStyle.TopLeft;
|
||||||
//
|
//
|
||||||
// labelSpeed
|
// labelSpeed
|
||||||
//
|
//
|
||||||
@@ -220,7 +220,7 @@ namespace GHelper
|
|||||||
labelSpeed.Name = "labelSpeed";
|
labelSpeed.Name = "labelSpeed";
|
||||||
labelSpeed.Size = new Size(198, 32);
|
labelSpeed.Size = new Size(198, 32);
|
||||||
labelSpeed.TabIndex = 40;
|
labelSpeed.TabIndex = 40;
|
||||||
labelSpeed.Text = Properties.Strings.AnimationSpeed;
|
labelSpeed.Text = "Animation Speed";
|
||||||
//
|
//
|
||||||
// comboKeyboardSpeed
|
// comboKeyboardSpeed
|
||||||
//
|
//
|
||||||
@@ -245,7 +245,7 @@ namespace GHelper
|
|||||||
checkShutdown.Name = "checkShutdown";
|
checkShutdown.Name = "checkShutdown";
|
||||||
checkShutdown.Size = new Size(154, 36);
|
checkShutdown.Size = new Size(154, 36);
|
||||||
checkShutdown.TabIndex = 3;
|
checkShutdown.TabIndex = 3;
|
||||||
checkShutdown.Text = Properties.Strings.Shutdown;
|
checkShutdown.Text = Strings.Shutdown;
|
||||||
checkShutdown.UseVisualStyleBackColor = true;
|
checkShutdown.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkSleep
|
// checkSleep
|
||||||
@@ -255,7 +255,7 @@ namespace GHelper
|
|||||||
checkSleep.Name = "checkSleep";
|
checkSleep.Name = "checkSleep";
|
||||||
checkSleep.Size = new Size(105, 36);
|
checkSleep.Size = new Size(105, 36);
|
||||||
checkSleep.TabIndex = 2;
|
checkSleep.TabIndex = 2;
|
||||||
checkSleep.Text = Properties.Strings.Sleep;
|
checkSleep.Text = Strings.Sleep;
|
||||||
checkSleep.UseVisualStyleBackColor = true;
|
checkSleep.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkBoot
|
// checkBoot
|
||||||
@@ -265,7 +265,7 @@ namespace GHelper
|
|||||||
checkBoot.Name = "checkBoot";
|
checkBoot.Name = "checkBoot";
|
||||||
checkBoot.Size = new Size(96, 36);
|
checkBoot.Size = new Size(96, 36);
|
||||||
checkBoot.TabIndex = 1;
|
checkBoot.TabIndex = 1;
|
||||||
checkBoot.Text = Properties.Strings.Boot;
|
checkBoot.Text = Strings.Boot;
|
||||||
checkBoot.UseVisualStyleBackColor = true;
|
checkBoot.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkAwake
|
// checkAwake
|
||||||
@@ -275,21 +275,32 @@ namespace GHelper
|
|||||||
checkAwake.Name = "checkAwake";
|
checkAwake.Name = "checkAwake";
|
||||||
checkAwake.Size = new Size(115, 36);
|
checkAwake.Size = new Size(115, 36);
|
||||||
checkAwake.TabIndex = 0;
|
checkAwake.TabIndex = 0;
|
||||||
checkAwake.Text = Properties.Strings.Awake;
|
checkAwake.Text = Strings.Awake;
|
||||||
checkAwake.UseVisualStyleBackColor = true;
|
checkAwake.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// groupOther
|
// groupOther
|
||||||
//
|
//
|
||||||
|
groupOther.Controls.Add(checkUSBC);
|
||||||
groupOther.Controls.Add(checkNoOverdrive);
|
groupOther.Controls.Add(checkNoOverdrive);
|
||||||
groupOther.Controls.Add(checkKeyboardAuto);
|
groupOther.Controls.Add(checkKeyboardAuto);
|
||||||
groupOther.Controls.Add(checkTopmost);
|
groupOther.Controls.Add(checkTopmost);
|
||||||
groupOther.Dock = DockStyle.Top;
|
groupOther.Dock = DockStyle.Top;
|
||||||
groupOther.Location = new Point(10, 626);
|
groupOther.Location = new Point(10, 647);
|
||||||
groupOther.Name = "groupOther";
|
groupOther.Name = "groupOther";
|
||||||
groupOther.Size = new Size(840, 225);
|
groupOther.Size = new Size(844, 293);
|
||||||
groupOther.TabIndex = 2;
|
groupOther.TabIndex = 2;
|
||||||
groupOther.TabStop = false;
|
groupOther.TabStop = false;
|
||||||
groupOther.Text = Properties.Strings.Other;
|
groupOther.Text = "Other";
|
||||||
|
//
|
||||||
|
// checkUSBC
|
||||||
|
//
|
||||||
|
checkUSBC.AutoSize = true;
|
||||||
|
checkUSBC.Location = new Point(25, 210);
|
||||||
|
checkUSBC.Name = "checkUSBC";
|
||||||
|
checkUSBC.Size = new Size(659, 36);
|
||||||
|
checkUSBC.TabIndex = 4;
|
||||||
|
checkUSBC.Text = "Keep GPU disabled on USB-C charger in Optimized mode";
|
||||||
|
checkUSBC.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkNoOverdrive
|
// checkNoOverdrive
|
||||||
//
|
//
|
||||||
@@ -298,7 +309,7 @@ namespace GHelper
|
|||||||
checkNoOverdrive.Name = "checkNoOverdrive";
|
checkNoOverdrive.Name = "checkNoOverdrive";
|
||||||
checkNoOverdrive.Size = new Size(307, 36);
|
checkNoOverdrive.Size = new Size(307, 36);
|
||||||
checkNoOverdrive.TabIndex = 3;
|
checkNoOverdrive.TabIndex = 3;
|
||||||
checkNoOverdrive.Text = Properties.Strings.DisableOverdrive;
|
checkNoOverdrive.Text = Strings.DisableOverdrive;
|
||||||
checkNoOverdrive.UseVisualStyleBackColor = true;
|
checkNoOverdrive.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkKeyboardAuto
|
// checkKeyboardAuto
|
||||||
@@ -309,7 +320,7 @@ namespace GHelper
|
|||||||
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
||||||
checkKeyboardAuto.Size = new Size(712, 36);
|
checkKeyboardAuto.Size = new Size(712, 36);
|
||||||
checkKeyboardAuto.TabIndex = 2;
|
checkKeyboardAuto.TabIndex = 2;
|
||||||
checkKeyboardAuto.Text = Properties.Strings.KeyboardAuto;
|
checkKeyboardAuto.Text = Strings.KeyboardAuto;
|
||||||
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkTopmost
|
// checkTopmost
|
||||||
@@ -319,28 +330,28 @@ namespace GHelper
|
|||||||
checkTopmost.Name = "checkTopmost";
|
checkTopmost.Name = "checkTopmost";
|
||||||
checkTopmost.Size = new Size(390, 36);
|
checkTopmost.Size = new Size(390, 36);
|
||||||
checkTopmost.TabIndex = 1;
|
checkTopmost.TabIndex = 1;
|
||||||
checkTopmost.Text = Properties.Strings.WindowTop;
|
checkTopmost.Text = Strings.WindowTop;
|
||||||
checkTopmost.UseVisualStyleBackColor = true;
|
checkTopmost.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// Keyboard
|
// Extra
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(860, 890);
|
ClientSize = new Size(864, 953);
|
||||||
Controls.Add(groupOther);
|
Controls.Add(groupOther);
|
||||||
Controls.Add(groupLight);
|
Controls.Add(groupLight);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBindings);
|
||||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MdiChildrenMinimizedAnchorBottom = false;
|
MdiChildrenMinimizedAnchorBottom = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
Name = "Keyboard";
|
Name = "Extra";
|
||||||
Padding = new Padding(10);
|
Padding = new Padding(10);
|
||||||
ShowIcon = false;
|
ShowIcon = false;
|
||||||
ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
Text = Properties.Strings.ExtraSettings;
|
Text = "Extra Settings";
|
||||||
groupBox1.ResumeLayout(false);
|
groupBindings.ResumeLayout(false);
|
||||||
groupBox1.PerformLayout();
|
groupBindings.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureHelp).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureHelp).EndInit();
|
||||||
groupLight.ResumeLayout(false);
|
groupLight.ResumeLayout(false);
|
||||||
groupLight.PerformLayout();
|
groupLight.PerformLayout();
|
||||||
@@ -352,7 +363,7 @@ namespace GHelper
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private GroupBox groupBox1;
|
private GroupBox groupBindings;
|
||||||
private Label labelM3;
|
private Label labelM3;
|
||||||
private RComboBox comboM3;
|
private RComboBox comboM3;
|
||||||
private RComboBox comboM4;
|
private RComboBox comboM4;
|
||||||
@@ -376,5 +387,6 @@ namespace GHelper
|
|||||||
private PictureBox pictureHelp;
|
private PictureBox pictureHelp;
|
||||||
private TrackBar trackBrightness;
|
private TrackBar trackBrightness;
|
||||||
private Label labelBrightness;
|
private Label labelBrightness;
|
||||||
|
private CheckBox checkUSBC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
public partial class Keyboard : RForm
|
public partial class Extra : RForm
|
||||||
{
|
{
|
||||||
|
|
||||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||||
@@ -15,6 +15,7 @@ namespace GHelper
|
|||||||
{"aura", Properties.Strings.ToggleAura},
|
{"aura", Properties.Strings.ToggleAura},
|
||||||
{"ghelper", Properties.Strings.OpenGHelper},
|
{"ghelper", Properties.Strings.OpenGHelper},
|
||||||
{"screen", Properties.Strings.ToggleScreen},
|
{"screen", Properties.Strings.ToggleScreen},
|
||||||
|
{"miniled", Properties.Strings.ToggleMiniled},
|
||||||
{"custom", Properties.Strings.Custom}
|
{"custom", Properties.Strings.Custom}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,9 +53,29 @@ namespace GHelper
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Keyboard()
|
public Extra()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
groupBindings.Text = Properties.Strings.KeyBindings;
|
||||||
|
groupLight.Text = Properties.Strings.KeyboardBacklight;
|
||||||
|
groupOther.Text = Properties.Strings.Other;
|
||||||
|
|
||||||
|
checkAwake.Text = Properties.Strings.Awake;
|
||||||
|
checkSleep.Text = Properties.Strings.Sleep;
|
||||||
|
checkBoot.Text = Properties.Strings.Boot;
|
||||||
|
checkShutdown.Text = Properties.Strings.Shutdown;
|
||||||
|
|
||||||
|
labelSpeed.Text = Properties.Strings.AnimationSpeed;
|
||||||
|
labelBrightness.Text = Properties.Strings.Brightness;
|
||||||
|
|
||||||
|
checkKeyboardAuto.Text = Properties.Strings.KeyboardAuto;
|
||||||
|
checkNoOverdrive.Text = Properties.Strings.DisableOverdrive;
|
||||||
|
checkTopmost.Text = Properties.Strings.WindowTop;
|
||||||
|
checkUSBC.Text = Properties.Strings.OptimizedUSBC;
|
||||||
|
|
||||||
|
Text = Properties.Strings.ExtraSettings;
|
||||||
|
|
||||||
InitTheme();
|
InitTheme();
|
||||||
|
|
||||||
SetKeyCombo(comboM3, textM3, "m3");
|
SetKeyCombo(comboM3, textM3, "m3");
|
||||||
@@ -89,6 +110,9 @@ namespace GHelper
|
|||||||
checkNoOverdrive.Checked = (Program.config.getConfig("no_overdrive") == 1);
|
checkNoOverdrive.Checked = (Program.config.getConfig("no_overdrive") == 1);
|
||||||
checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged;
|
checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged;
|
||||||
|
|
||||||
|
checkUSBC.Checked = (Program.config.getConfig("optimized_usbc") == 1);
|
||||||
|
checkUSBC.CheckedChanged += CheckUSBC_CheckedChanged;
|
||||||
|
|
||||||
int kb_brightness = Program.config.getConfig("keyboard_brightness");
|
int kb_brightness = Program.config.getConfig("keyboard_brightness");
|
||||||
trackBrightness.Value = (kb_brightness >= 0 && kb_brightness <= 3) ? kb_brightness : 3;
|
trackBrightness.Value = (kb_brightness >= 0 && kb_brightness <= 3) ? kb_brightness : 3;
|
||||||
|
|
||||||
@@ -97,6 +121,11 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckUSBC_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Program.config.setConfig("optimized_usbc", (checkUSBC.Checked ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
private void TrackBrightness_Scroll(object? sender, EventArgs e)
|
private void TrackBrightness_Scroll(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Program.config.setConfig("keyboard_brightness", trackBrightness.Value);
|
Program.config.setConfig("keyboard_brightness", trackBrightness.Value);
|
||||||
18
app/Fans.cs
18
app/Fans.cs
@@ -86,13 +86,21 @@ namespace GHelper
|
|||||||
|
|
||||||
private void InitGPUClocks()
|
private void InitGPUClocks()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var _gpuControl = new NvidiaGpuControl())
|
||||||
|
{
|
||||||
|
panelGPU.Visible = _gpuControl.IsValid;
|
||||||
|
|
||||||
panelGPU.Visible = HardwareMonitor.GpuControl.IsNvidia;
|
trackGPUCore.Value = Math.Min(Program.config.getConfig("GPUCore"), 300);
|
||||||
|
trackGPUMemory.Value = Math.Min(Program.config.getConfig("GPUMemory"), 300);
|
||||||
|
VisualiseGPUClocks();
|
||||||
|
}
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
panelGPU.Visible=false;
|
||||||
|
}
|
||||||
|
|
||||||
trackGPUCore.Value = Math.Min(Program.config.getConfig("GPUCore"), 300);
|
|
||||||
trackGPUMemory.Value = Math.Min(Program.config.getConfig("GPUMemory"), 300);
|
|
||||||
|
|
||||||
VisualiseGPUClocks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonResetGPU_Click(object? sender, EventArgs e)
|
private void ButtonResetGPU_Click(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -56,14 +56,9 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
PhysicalGPU internalGpu = _internalGpu!;
|
PhysicalGPU internalGpu = _internalGpu!;
|
||||||
|
|
||||||
IUtilizationDomainInfo? gpuUsage = GPUApi.GetUsages(internalGpu.Handle).GPU;
|
IUtilizationDomainInfo? gpuUsage = GPUApi.GetUsages(internalGpu.Handle).GPU;
|
||||||
|
|
||||||
if (gpuUsage == null)
|
return (int?)gpuUsage?.Percentage;
|
||||||
return null;
|
|
||||||
|
|
||||||
return
|
|
||||||
(int)gpuUsage?.Percentage;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,22 +124,22 @@ public static class HardwareMonitor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecreateGpuTemperatureProviderWithDelay()
|
public static void RecreateGpuControlWithDelay(int delay = 5)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Re-enabling the discrete GPU takes a bit of time,
|
// Re-enabling the discrete GPU takes a bit of time,
|
||||||
// so a simple workaround is to refresh again after that happens
|
// so a simple workaround is to refresh again after that happens
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
await Task.Delay(TimeSpan.FromSeconds(delay));
|
||||||
RecreateGpuTemperatureProvider();
|
RecreateGpuControl();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecreateGpuTemperatureProvider()
|
public static void RecreateGpuControl()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace GHelper
|
|||||||
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
|
|
||||||
HardwareMonitor.RecreateGpuTemperatureProvider();
|
HardwareMonitor.RecreateGpuControl();
|
||||||
|
|
||||||
// Subscribing for system power change events
|
// Subscribing for system power change events
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
@@ -172,10 +172,10 @@ namespace GHelper
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void SetAutoModes()
|
public static void SetAutoModes(bool monitor = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 2000) return;
|
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 3000) return;
|
||||||
lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
|
isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||||
@@ -184,7 +184,8 @@ namespace GHelper
|
|||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
settingsForm.AutoPerformance();
|
settingsForm.AutoPerformance();
|
||||||
|
|
||||||
bool switched = settingsForm.AutoGPUMode();
|
bool switched = false;
|
||||||
|
if (monitor) switched = settingsForm.AutoGPUMode();
|
||||||
|
|
||||||
if (!switched)
|
if (!switched)
|
||||||
{
|
{
|
||||||
@@ -270,6 +271,9 @@ namespace GHelper
|
|||||||
case "screen":
|
case "screen":
|
||||||
NativeMethods.TurnOffScreen(Program.settingsForm.Handle);
|
NativeMethods.TurnOffScreen(Program.settingsForm.Handle);
|
||||||
break;
|
break;
|
||||||
|
case "miniled":
|
||||||
|
settingsForm.BeginInvoke(settingsForm.ToogleMiniled);
|
||||||
|
break;
|
||||||
case "aura":
|
case "aura":
|
||||||
settingsForm.BeginInvoke(settingsForm.CycleAuraMode);
|
settingsForm.BeginInvoke(settingsForm.CycleAuraMode);
|
||||||
break;
|
break;
|
||||||
|
|||||||
18
app/Properties/Strings.Designer.cs
generated
18
app/Properties/Strings.Designer.cs
generated
@@ -699,6 +699,15 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Keep GPU disabled on USB-C charger in Optimized mode.
|
||||||
|
/// </summary>
|
||||||
|
internal static string OptimizedUSBC {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("OptimizedUSBC", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Other.
|
/// Looks up a localized string similar to Other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -861,6 +870,15 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Toggle Miniled (if supported).
|
||||||
|
/// </summary>
|
||||||
|
internal static string ToggleMiniled {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ToggleMiniled", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Toggle Screen.
|
/// Looks up a localized string similar to Toggle Screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -330,6 +330,9 @@
|
|||||||
<data name="OptimizedGPUTooltip" xml:space="preserve">
|
<data name="OptimizedGPUTooltip" xml:space="preserve">
|
||||||
<value>Switch to Eco on battery and to Standard when plugged</value>
|
<value>Switch to Eco on battery and to Standard when plugged</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="OptimizedUSBC" xml:space="preserve">
|
||||||
|
<value>Keep GPU disabled on USB-C charger in Optimized mode</value>
|
||||||
|
</data>
|
||||||
<data name="Other" xml:space="preserve">
|
<data name="Other" xml:space="preserve">
|
||||||
<value>Other</value>
|
<value>Other</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -384,6 +387,9 @@
|
|||||||
<data name="ToggleAura" xml:space="preserve">
|
<data name="ToggleAura" xml:space="preserve">
|
||||||
<value>Toggle Aura</value>
|
<value>Toggle Aura</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ToggleMiniled" xml:space="preserve">
|
||||||
|
<value>Toggle Miniled (if supported)</value>
|
||||||
|
</data>
|
||||||
<data name="ToggleScreen" xml:space="preserve">
|
<data name="ToggleScreen" xml:space="preserve">
|
||||||
<value>Toggle Screen</value>
|
<value>Toggle Screen</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -367,7 +367,7 @@
|
|||||||
<value>關機時</value>
|
<value>關機時</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Silent" xml:space="preserve">
|
<data name="Silent" xml:space="preserve">
|
||||||
<value>安静模式</value>
|
<value>安靜模式</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Sleep" xml:space="preserve">
|
<data name="Sleep" xml:space="preserve">
|
||||||
<value>睡眠時</value>
|
<value>睡眠時</value>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace GHelper
|
|||||||
public string perfName = "Balanced";
|
public string perfName = "Balanced";
|
||||||
|
|
||||||
public Fans fans;
|
public Fans fans;
|
||||||
public Keyboard keyb;
|
public Extra keyb;
|
||||||
|
|
||||||
static AnimeMatrixDevice mat;
|
static AnimeMatrixDevice mat;
|
||||||
static long lastRefresh;
|
static long lastRefresh;
|
||||||
@@ -186,10 +186,7 @@ namespace GHelper
|
|||||||
|
|
||||||
if (gitVersion.CompareTo(appVersion) > 0)
|
if (gitVersion.CompareTo(appVersion) > 0)
|
||||||
{
|
{
|
||||||
BeginInvoke(delegate
|
SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, url);
|
||||||
{
|
|
||||||
SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, url);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -294,7 +291,7 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Logger.WriteLine("Monitor Power On");
|
Logger.WriteLine("Monitor Power On");
|
||||||
Program.SetAutoModes();
|
Program.SetAutoModes(false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Logger.WriteLine("Monitor Dimmed");
|
Logger.WriteLine("Monitor Dimmed");
|
||||||
@@ -561,7 +558,7 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
if (keyb == null || keyb.Text == "")
|
if (keyb == null || keyb.Text == "")
|
||||||
{
|
{
|
||||||
keyb = new Keyboard();
|
keyb = new Extra();
|
||||||
keyb.Show();
|
keyb.Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -692,13 +689,18 @@ namespace GHelper
|
|||||||
SetScreen(60, 0);
|
SetScreen(60, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonMiniled_Click(object? sender, EventArgs e)
|
public void ToogleMiniled()
|
||||||
{
|
{
|
||||||
int miniled = (Program.config.getConfig("miniled") == 1) ? 0 : 1;
|
int miniled = (Program.config.getConfig("miniled") == 1) ? 0 : 1;
|
||||||
Program.config.setConfig("miniled", miniled);
|
Program.config.setConfig("miniled", miniled);
|
||||||
SetScreen(-1, -1, miniled);
|
SetScreen(-1, -1, miniled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonMiniled_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ToogleMiniled();
|
||||||
|
}
|
||||||
|
|
||||||
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -853,6 +855,7 @@ namespace GHelper
|
|||||||
gpuTemp = $": {HardwareMonitor.gpuTemp}°C ";
|
gpuTemp = $": {HardwareMonitor.gpuTemp}°C ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Program.settingsForm.BeginInvoke(delegate
|
Program.settingsForm.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
|
labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
|
||||||
@@ -921,10 +924,12 @@ namespace GHelper
|
|||||||
customPower = limit_cpu;
|
customPower = limit_cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_APUC2) >= 0)
|
if (Program.wmi.DeviceGet(ASUSWmi.PPT_APUC2) >= 0)
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_APUC2, 87, "PowerLimit C2");
|
Program.wmi.DeviceSet(ASUSWmi.PPT_APUC2, 87, "PowerLimit C2");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Program.settingsForm.BeginInvoke(SetPerformanceLabel);
|
Program.settingsForm.BeginInvoke(SetPerformanceLabel);
|
||||||
|
|
||||||
@@ -1137,11 +1142,18 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsPlugged()
|
||||||
|
{
|
||||||
|
bool optimizedUSBC = Program.config.getConfig("optimized_usbc") != 1;
|
||||||
|
|
||||||
|
return SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online &&
|
||||||
|
(optimizedUSBC || Program.wmi.DeviceGet(ASUSWmi.ChargerMode) != ASUSWmi.ChargerUSB);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool AutoGPUMode()
|
public bool AutoGPUMode()
|
||||||
{
|
{
|
||||||
|
|
||||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
|
||||||
|
|
||||||
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
|
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
|
||||||
bool ForceGPU = Program.config.ContainsModel("503");
|
bool ForceGPU = Program.config.ContainsModel("503");
|
||||||
|
|
||||||
@@ -1156,14 +1168,17 @@ namespace GHelper
|
|||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (ReEnableGPU()) return true;
|
||||||
|
|
||||||
if (eco == 1)
|
if (eco == 1)
|
||||||
if ((GpuAuto && Plugged == PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
if ((GpuAuto && IsPlugged()) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
||||||
{
|
{
|
||||||
SetEcoGPU(0);
|
SetEcoGPU(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (eco == 0)
|
if (eco == 0)
|
||||||
if ((GpuAuto && Plugged != PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
if ((GpuAuto && !IsPlugged()) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (HardwareMonitor.IsUsedGPU())
|
if (HardwareMonitor.IsUsedGPU())
|
||||||
@@ -1181,6 +1196,20 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ReEnableGPU()
|
||||||
|
{
|
||||||
|
if (Screen.AllScreens.Length <= 1) return false;
|
||||||
|
if (Program.config.getConfig("gpu_reenable") != 1) return false;
|
||||||
|
|
||||||
|
Logger.WriteLine("Re-enabling gpu for 503 model");
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
SetEcoGPU(1);
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
SetEcoGPU(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void UltimateUI(bool ultimate)
|
private void UltimateUI(bool ultimate)
|
||||||
{
|
{
|
||||||
if (!ultimate)
|
if (!ultimate)
|
||||||
@@ -1269,7 +1298,7 @@ namespace GHelper
|
|||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco, "GPUEco");
|
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco, "GPUEco");
|
||||||
|
|
||||||
if (eco == 0)
|
if (eco == 0)
|
||||||
HardwareMonitor.RecreateGpuTemperatureProviderWithDelay();
|
HardwareMonitor.RecreateGpuControlWithDelay();
|
||||||
|
|
||||||
Program.settingsForm.BeginInvoke(delegate
|
Program.settingsForm.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user