mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
21 Commits
v0.119
...
Fan-Calibr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f0e4431e6 | ||
|
|
bff2676b64 | ||
|
|
e9e5fe1cc9 | ||
|
|
e6a78fc8f7 | ||
|
|
0e3efcf547 | ||
|
|
4ae3fb4e3d | ||
|
|
20e7dd96a1 | ||
|
|
d36cd409a4 | ||
|
|
082eceed9a | ||
|
|
46c91d1956 | ||
|
|
edfb829988 | ||
|
|
83cb28e99c | ||
|
|
957916bfdf | ||
|
|
2f98606a7d | ||
|
|
c791421c3e | ||
|
|
fa79a72247 | ||
|
|
831f7b8989 | ||
|
|
77800475cb | ||
|
|
96553a162c | ||
|
|
d1e987f4da | ||
|
|
a1fb740c27 |
@@ -1,14 +1,11 @@
|
|||||||
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
||||||
|
|
||||||
using GHelper;
|
|
||||||
using GHelper.AnimeMatrix.Communication;
|
using GHelper.AnimeMatrix.Communication;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Globalization;
|
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
{
|
{
|
||||||
@@ -80,6 +77,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class AnimeMatrixDevice : Device
|
public class AnimeMatrixDevice : Device
|
||||||
{
|
{
|
||||||
int UpdatePageLength = 490;
|
int UpdatePageLength = 490;
|
||||||
@@ -89,31 +87,36 @@ namespace Starlight.AnimeMatrix
|
|||||||
List<byte[]> frames = new List<byte[]>();
|
List<byte[]> frames = new List<byte[]>();
|
||||||
|
|
||||||
public int MaxRows = 61;
|
public int MaxRows = 61;
|
||||||
//public int FullRows = 11;
|
|
||||||
//public int FullEvenRows = -1;
|
|
||||||
|
|
||||||
public int dx = 0;
|
|
||||||
public int MaxColumns = 34;
|
public int MaxColumns = 34;
|
||||||
|
public int LedStart = 0;
|
||||||
|
|
||||||
|
public int TextShift = 8;
|
||||||
|
|
||||||
private int frameIndex = 0;
|
private int frameIndex = 0;
|
||||||
|
|
||||||
private static AnimeType _model = AnimeType.GA402;
|
private static AnimeType _model = AnimeType.GA402;
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||||
|
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts);
|
||||||
|
private PrivateFontCollection fonts = new PrivateFontCollection();
|
||||||
|
|
||||||
public AnimeMatrixDevice()
|
public AnimeMatrixDevice() : base(0x0B05, 0x193B, 640)
|
||||||
: base(0x0B05, 0x193B, 640)
|
|
||||||
{
|
{
|
||||||
string model = GetModel();
|
string model = GetModel();
|
||||||
|
|
||||||
if (model.Contains("401"))
|
if (model.Contains("401"))
|
||||||
{
|
{
|
||||||
_model = AnimeType.GA401;
|
_model = AnimeType.GA401;
|
||||||
|
|
||||||
MaxColumns = 33;
|
MaxColumns = 33;
|
||||||
dx = 1;
|
|
||||||
MaxRows = 55;
|
MaxRows = 55;
|
||||||
LedCount = 1245;
|
LedCount = 1245;
|
||||||
|
|
||||||
UpdatePageLength = 410;
|
UpdatePageLength = 410;
|
||||||
|
|
||||||
|
TextShift = 11;
|
||||||
|
|
||||||
|
LedStart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.Contains("GU604"))
|
if (model.Contains("GU604"))
|
||||||
@@ -124,12 +127,35 @@ namespace Starlight.AnimeMatrix
|
|||||||
MaxRows = 92;
|
MaxRows = 92;
|
||||||
LedCount = 1711;
|
LedCount = 1711;
|
||||||
UpdatePageLength = 630;
|
UpdatePageLength = 630;
|
||||||
|
|
||||||
|
TextShift = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
_displayBuffer = new byte[LedCount];
|
_displayBuffer = new byte[LedCount];
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (int i = 0; i < MaxRows; i++)
|
||||||
|
{
|
||||||
|
_model = AnimeType.GA401;
|
||||||
|
Logger.WriteLine(FirstX(i) + " " + Pitch(i));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
LoadMFont();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadMFont()
|
||||||
|
{
|
||||||
|
byte[] fontData = GHelper.Properties.Resources.MFont;
|
||||||
|
IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length);
|
||||||
|
System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length);
|
||||||
|
uint dummy = 0;
|
||||||
|
|
||||||
|
fonts.AddMemoryFont(fontPtr, GHelper.Properties.Resources.MFont.Length);
|
||||||
|
AddFontMemResourceEx(fontPtr, (uint)GHelper.Properties.Resources.MFont.Length, IntPtr.Zero, ref dummy);
|
||||||
|
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
|
||||||
|
}
|
||||||
|
|
||||||
public string GetModel()
|
public string GetModel()
|
||||||
{
|
{
|
||||||
@@ -173,32 +199,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int FirstX(int y)
|
public int Width()
|
||||||
{
|
|
||||||
switch (_model)
|
|
||||||
{
|
|
||||||
case AnimeType.GA401:
|
|
||||||
if (y < 5)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (y + 1) / 2 - 3;
|
|
||||||
}
|
|
||||||
case AnimeType.GU604:
|
|
||||||
if (y < 9 && y % 2 == 0)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return (int)Math.Ceiling(Math.Max(0, y - 9) / 2F);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Width(int y)
|
|
||||||
{
|
{
|
||||||
switch (_model)
|
switch (_model)
|
||||||
{
|
{
|
||||||
@@ -211,7 +212,30 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Pitch(int y)
|
public int FirstX(int y)
|
||||||
|
{
|
||||||
|
switch (_model)
|
||||||
|
{
|
||||||
|
case AnimeType.GA401:
|
||||||
|
if (y < 5 && y % 2 == 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 5) / 2F);
|
||||||
|
case AnimeType.GU604:
|
||||||
|
if (y < 9 && y % 2 == 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 9) / 2F);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int Pitch(int y)
|
||||||
{
|
{
|
||||||
switch (_model)
|
switch (_model)
|
||||||
{
|
{
|
||||||
@@ -247,19 +271,19 @@ namespace Starlight.AnimeMatrix
|
|||||||
return 39;
|
return 39;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Width(y) - FirstX(y);
|
return Width() - FirstX(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Width(y) - FirstX(y);
|
return Width() - FirstX(y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int RowToLinearAddress(int y)
|
public int RowToLinearAddress(int y)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = LedStart;
|
||||||
for (var i = 0; i < y; i++)
|
for (var i = 0; i < y; i++)
|
||||||
ret += Pitch(i);
|
ret += Pitch(i);
|
||||||
|
|
||||||
@@ -270,8 +294,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
if (!IsRowInRange(y)) return;
|
if (!IsRowInRange(y)) return;
|
||||||
|
|
||||||
if (x >= FirstX(y) && x < Width(y))
|
if (x >= FirstX(y) && x < Width())
|
||||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WakeUp()
|
public void WakeUp()
|
||||||
@@ -369,20 +393,49 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public void PresentClock()
|
public void PresentClock()
|
||||||
{
|
{
|
||||||
int second = DateTime.Now.Second;
|
string second = (DateTime.Now.Second % 2 == 0) ? ":" : " ";
|
||||||
string time;
|
string time = DateTime.Now.ToString("HH" + second + "mm");
|
||||||
|
|
||||||
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
Clear();
|
||||||
time = DateTime.Now.ToString("H" + ((second % 2 == 0) ? ":" : " ") + "mm");
|
TextDiagonal(time, 15, 12, TextShift + 11);
|
||||||
else
|
TextDiagonal(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11.5F, 3, TextShift);
|
||||||
time = DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt");
|
Present();
|
||||||
|
|
||||||
if (_model == AnimeType.GA401)
|
|
||||||
PresentText(time);
|
|
||||||
else
|
|
||||||
PresentTextDiagonal(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TextDiagonal(string text, float fontSize = 10, int deltaX = 0, int deltaY = 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
||||||
|
int textHeight;
|
||||||
|
|
||||||
|
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
||||||
|
{
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
||||||
|
|
||||||
|
using (Font font = new Font(fonts.Families[0], fontSize, FontStyle.Regular, GraphicsUnit.Pixel))
|
||||||
|
{
|
||||||
|
SizeF textSize = g.MeasureString(text, font);
|
||||||
|
textHeight = (int)textSize.Height;
|
||||||
|
g.DrawString(text, font, Brushes.White, 0, 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;
|
||||||
|
if (color > 100) SetLedDiagonal(x, y, (byte)color, deltaX, deltaY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void PresentText(string text1, string text2 = "")
|
public void PresentText(string text1, string text2 = "")
|
||||||
@@ -410,42 +463,25 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bmp.Save("test.bmp", ImageFormat.Bmp);
|
||||||
|
|
||||||
GenerateFrame(bmp);
|
GenerateFrame(bmp);
|
||||||
Present();
|
Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateFrame(Image image, float zoom = 1, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
||||||
{
|
|
||||||
using (Bitmap bmp = GeneratePicture(image, zoom, panX, panY, quality))
|
|
||||||
{
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
|
||||||
if (x % 2 == (y + dx) % 2)
|
|
||||||
{
|
|
||||||
var pixel = bmp.GetPixel(x, y);
|
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
|
||||||
if (color < 10) color = 0;
|
|
||||||
SetLedPlanar(x / 2, y, (byte)color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Bitmap GeneratePicture(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = MaxColumns * 3;
|
int width = MaxColumns / 2 * 6;
|
||||||
int height = MaxRows;
|
int height = MaxRows;
|
||||||
|
|
||||||
int targetWidth = MaxColumns * 2;
|
int targetWidth = MaxColumns * 2;
|
||||||
|
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(targetWidth, height);
|
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
||||||
{
|
{
|
||||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height) * zoom / 100;
|
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height) * zoom / 100;
|
||||||
|
|
||||||
@@ -459,61 +495,35 @@ namespace Starlight.AnimeMatrix
|
|||||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
graph.DrawImage(image, (float)Math.Round(targetWidth - (scaleWidth + panX) * targetWidth / width), -panY, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
graph.DrawImage(image, (float)Math.Round(targetWidth - (scaleWidth + panX) * targetWidth / width), -panY, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SetLedDiagonal(int x, int y, byte color, int delta = 10)
|
|
||||||
{
|
|
||||||
//x += delta;
|
|
||||||
y -= delta;
|
|
||||||
|
|
||||||
int dx = (x - y) / 2;
|
|
||||||
int dy = x + y;
|
|
||||||
SetLedPlanar(dx, dy, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PresentTextDiagonal(string text)
|
|
||||||
{
|
|
||||||
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
|
||||||
int textHeight;
|
|
||||||
|
|
||||||
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
|
||||||
{
|
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
|
||||||
{
|
|
||||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
|
||||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
|
||||||
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
|
||||||
|
|
||||||
using (Font font = new Font("Consolas", 11, FontStyle.Regular, GraphicsUnit.Pixel))
|
|
||||||
{
|
|
||||||
SizeF textSize = g.MeasureString(text, font);
|
|
||||||
textHeight = (int)textSize.Height;
|
|
||||||
g.DrawString(text, font, Brushes.White, 4, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
{
|
if (x % 2 == y % 2)
|
||||||
var pixel = bmp.GetPixel(x, y);
|
{
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
var pixel = bmp.GetPixel(x, y);
|
||||||
SetLedDiagonal(x, y, (byte)color, textHeight - 8);
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
}
|
if (color < 10) color = 0;
|
||||||
|
SetLedPlanar(x / 2, y, (byte)color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 10)
|
||||||
|
{
|
||||||
|
x += deltaX;
|
||||||
|
y -= deltaY;
|
||||||
|
|
||||||
|
int plX = (x - y) / 2;
|
||||||
|
int plY = x + y;
|
||||||
|
SetLedPlanar(plX, plY, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool IsRowInRange(int row)
|
private bool IsRowInRange(int row)
|
||||||
{
|
{
|
||||||
return (row >= 0 && row < MaxRows);
|
return (row >= 0 && row < MaxRows);
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsNoGPUModes()
|
public static bool IsNoGPUModes()
|
||||||
{
|
{
|
||||||
return ContainsModel("GV301RA") || ContainsModel("GV302XA");
|
return ContainsModel("GV301RA") || ContainsModel("GV302XA") || IsAlly();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Management;
|
using GHelper;
|
||||||
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public enum AsusFan
|
public enum AsusFan
|
||||||
@@ -60,7 +61,6 @@ public class AsusACPI
|
|||||||
|
|
||||||
public const uint GPUEco = 0x00090020;
|
public const uint GPUEco = 0x00090020;
|
||||||
|
|
||||||
public const uint GPUXGInit = 0x00090017;
|
|
||||||
public const uint GPUXGConnected = 0x00090018;
|
public const uint GPUXGConnected = 0x00090018;
|
||||||
public const uint GPUXG = 0x00090019;
|
public const uint GPUXG = 0x00090019;
|
||||||
|
|
||||||
@@ -94,6 +94,7 @@ public class AsusACPI
|
|||||||
|
|
||||||
public const int TUF_KB_BRIGHTNESS = 0x00050021;
|
public const int TUF_KB_BRIGHTNESS = 0x00050021;
|
||||||
public const int TUF_KB = 0x00100056;
|
public const int TUF_KB = 0x00100056;
|
||||||
|
public const int TUF_KB2 = 0x0010005a;
|
||||||
public const int TUF_KB_STATE = 0x00100057;
|
public const int TUF_KB_STATE = 0x00100057;
|
||||||
|
|
||||||
public const int MICMUTE_LED = 0x00040017;
|
public const int MICMUTE_LED = 0x00040017;
|
||||||
@@ -104,6 +105,8 @@ public class AsusACPI
|
|||||||
public const int ScreenPadToggle = 0x00050031;
|
public const int ScreenPadToggle = 0x00050031;
|
||||||
public const int ScreenPadBrightness = 0x00050032;
|
public const int ScreenPadBrightness = 0x00050032;
|
||||||
|
|
||||||
|
public const int BootSound = 0x00130022;
|
||||||
|
|
||||||
public const int Tablet_Notebook = 0;
|
public const int Tablet_Notebook = 0;
|
||||||
public const int Tablet_Tablet = 1;
|
public const int Tablet_Tablet = 1;
|
||||||
public const int Tablet_Tent = 2;
|
public const int Tablet_Tent = 2;
|
||||||
@@ -344,6 +347,32 @@ public class AsusACPI
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetFan(AsusFan device)
|
||||||
|
{
|
||||||
|
int fan = -1;
|
||||||
|
|
||||||
|
switch (device)
|
||||||
|
{
|
||||||
|
case AsusFan.GPU:
|
||||||
|
fan = Program.acpi.DeviceGet(GPU_Fan);
|
||||||
|
break;
|
||||||
|
case AsusFan.Mid:
|
||||||
|
fan = Program.acpi.DeviceGet(Mid_Fan);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fan = Program.acpi.DeviceGet(CPU_Fan);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fan < 0)
|
||||||
|
{
|
||||||
|
fan += 65536;
|
||||||
|
if (fan <= 0 || fan > 100) fan = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fan;
|
||||||
|
}
|
||||||
|
|
||||||
public int SetFanRange(AsusFan device, byte[] curve)
|
public int SetFanRange(AsusFan device, byte[] curve)
|
||||||
{
|
{
|
||||||
byte min = (byte)(curve[8] * 255 / 100);
|
byte min = (byte)(curve[8] * 255 / 100);
|
||||||
@@ -377,7 +406,7 @@ public class AsusACPI
|
|||||||
|
|
||||||
// it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
|
// it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
|
||||||
|
|
||||||
for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)99, curve[i])) * fanScale / 100);
|
for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)100, curve[i])) * fanScale / 100);
|
||||||
|
|
||||||
switch (device)
|
switch (device)
|
||||||
{
|
{
|
||||||
@@ -520,14 +549,8 @@ public class AsusACPI
|
|||||||
setting[4] = color.B;
|
setting[4] = color.B;
|
||||||
setting[5] = (byte)speed;
|
setting[5] = (byte)speed;
|
||||||
|
|
||||||
DeviceSet(TUF_KB, setting, "TUF RGB");
|
int result = DeviceSet(TUF_KB, setting, "TUF RGB");
|
||||||
|
if (result != 1) DeviceSet(TUF_KB2, setting, "TUF RGB");
|
||||||
/*
|
|
||||||
setting[0] = (byte)0xb4;
|
|
||||||
DeviceSet(TUF_KB, setting, "TUF RGB");
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Debug.WriteLine(BitConverter.ToString(setting));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -644,6 +644,8 @@ namespace GHelper
|
|||||||
byte[] ASUS_INIT = Encoding.ASCII.GetBytes("^ASUS Tech.Inc.");
|
byte[] ASUS_INIT = Encoding.ASCII.GetBytes("^ASUS Tech.Inc.");
|
||||||
|
|
||||||
SetXGM(ASUS_INIT);
|
SetXGM(ASUS_INIT);
|
||||||
|
|
||||||
|
/*
|
||||||
SetXGM(new byte[] { 0x5e, 0xd0, 0x02 });
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x02 });
|
||||||
SetXGM(new byte[] { 0x5e, 0xd0, 0x03 });
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x03 });
|
||||||
SetXGM(ASUS_INIT);
|
SetXGM(ASUS_INIT);
|
||||||
@@ -652,6 +654,7 @@ namespace GHelper
|
|||||||
SetXGM(new byte[] { 0x5e, 0xce, 0x03 });
|
SetXGM(new byte[] { 0x5e, 0xce, 0x03 });
|
||||||
SetXGM(new byte[] { 0x5e, 0xd0, 0x04 });
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x04 });
|
||||||
SetXGM(new byte[] { 0x5e, 0xd0, 0x01 });
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x01 });
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyXGMLight(bool status)
|
public static void ApplyXGMLight(bool status)
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
if (limit < 0) limit = AppConfig.Get("charge_limit");
|
if (limit < 0) limit = AppConfig.Get("charge_limit");
|
||||||
if (limit < 40 || limit > 100) return;
|
if (limit < 40 || limit > 100) return;
|
||||||
|
|
||||||
Program.settingsForm.VisualiseBattery(limit);
|
|
||||||
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
|
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
|
||||||
|
Program.settingsForm.VisualiseBattery(limit);
|
||||||
|
|
||||||
AppConfig.Set("charge_limit", limit);
|
AppConfig.Set("charge_limit", limit);
|
||||||
|
|
||||||
|
|||||||
28
app/Extra.Designer.cs
generated
28
app/Extra.Designer.cs
generated
@@ -115,6 +115,7 @@ namespace GHelper
|
|||||||
labelHibernateAfter = new Label();
|
labelHibernateAfter = new Label();
|
||||||
pictureHibernate = new PictureBox();
|
pictureHibernate = new PictureBox();
|
||||||
toolTip = new ToolTip(components);
|
toolTip = new ToolTip(components);
|
||||||
|
checkBootSound = new CheckBox();
|
||||||
panelServices.SuspendLayout();
|
panelServices.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
|
||||||
panelBindingsHeader.SuspendLayout();
|
panelBindingsHeader.SuspendLayout();
|
||||||
@@ -147,7 +148,7 @@ namespace GHelper
|
|||||||
panelServices.Controls.Add(labelServices);
|
panelServices.Controls.Add(labelServices);
|
||||||
panelServices.Controls.Add(buttonServices);
|
panelServices.Controls.Add(buttonServices);
|
||||||
panelServices.Dock = DockStyle.Top;
|
panelServices.Dock = DockStyle.Top;
|
||||||
panelServices.Location = new Point(15, 1279);
|
panelServices.Location = new Point(15, 1321);
|
||||||
panelServices.Name = "panelServices";
|
panelServices.Name = "panelServices";
|
||||||
panelServices.Size = new Size(983, 75);
|
panelServices.Size = new Size(983, 75);
|
||||||
panelServices.TabIndex = 5;
|
panelServices.TabIndex = 5;
|
||||||
@@ -1065,6 +1066,7 @@ namespace GHelper
|
|||||||
panelSettings.Controls.Add(checkAutoToggleClamshellMode);
|
panelSettings.Controls.Add(checkAutoToggleClamshellMode);
|
||||||
panelSettings.Controls.Add(checkTopmost);
|
panelSettings.Controls.Add(checkTopmost);
|
||||||
panelSettings.Controls.Add(checkNoOverdrive);
|
panelSettings.Controls.Add(checkNoOverdrive);
|
||||||
|
panelSettings.Controls.Add(checkBootSound);
|
||||||
panelSettings.Controls.Add(checkUSBC);
|
panelSettings.Controls.Add(checkUSBC);
|
||||||
panelSettings.Controls.Add(checkVariBright);
|
panelSettings.Controls.Add(checkVariBright);
|
||||||
panelSettings.Controls.Add(checkGpuApps);
|
panelSettings.Controls.Add(checkGpuApps);
|
||||||
@@ -1073,14 +1075,14 @@ namespace GHelper
|
|||||||
panelSettings.Location = new Point(15, 921);
|
panelSettings.Location = new Point(15, 921);
|
||||||
panelSettings.Name = "panelSettings";
|
panelSettings.Name = "panelSettings";
|
||||||
panelSettings.Padding = new Padding(20, 5, 11, 5);
|
panelSettings.Padding = new Padding(20, 5, 11, 5);
|
||||||
panelSettings.Size = new Size(983, 304);
|
panelSettings.Size = new Size(983, 346);
|
||||||
panelSettings.TabIndex = 3;
|
panelSettings.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// checkAutoToggleClamshellMode
|
// checkAutoToggleClamshellMode
|
||||||
//
|
//
|
||||||
checkAutoToggleClamshellMode.AutoSize = true;
|
checkAutoToggleClamshellMode.AutoSize = true;
|
||||||
checkAutoToggleClamshellMode.Dock = DockStyle.Top;
|
checkAutoToggleClamshellMode.Dock = DockStyle.Top;
|
||||||
checkAutoToggleClamshellMode.Location = new Point(20, 257);
|
checkAutoToggleClamshellMode.Location = new Point(20, 299);
|
||||||
checkAutoToggleClamshellMode.Name = "checkAutoToggleClamshellMode";
|
checkAutoToggleClamshellMode.Name = "checkAutoToggleClamshellMode";
|
||||||
checkAutoToggleClamshellMode.Padding = new Padding(3);
|
checkAutoToggleClamshellMode.Padding = new Padding(3);
|
||||||
checkAutoToggleClamshellMode.Size = new Size(952, 42);
|
checkAutoToggleClamshellMode.Size = new Size(952, 42);
|
||||||
@@ -1092,7 +1094,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
checkTopmost.AutoSize = true;
|
checkTopmost.AutoSize = true;
|
||||||
checkTopmost.Dock = DockStyle.Top;
|
checkTopmost.Dock = DockStyle.Top;
|
||||||
checkTopmost.Location = new Point(20, 215);
|
checkTopmost.Location = new Point(20, 257);
|
||||||
checkTopmost.Margin = new Padding(4, 3, 4, 3);
|
checkTopmost.Margin = new Padding(4, 3, 4, 3);
|
||||||
checkTopmost.Name = "checkTopmost";
|
checkTopmost.Name = "checkTopmost";
|
||||||
checkTopmost.Padding = new Padding(3);
|
checkTopmost.Padding = new Padding(3);
|
||||||
@@ -1105,7 +1107,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
checkNoOverdrive.AutoSize = true;
|
checkNoOverdrive.AutoSize = true;
|
||||||
checkNoOverdrive.Dock = DockStyle.Top;
|
checkNoOverdrive.Dock = DockStyle.Top;
|
||||||
checkNoOverdrive.Location = new Point(20, 173);
|
checkNoOverdrive.Location = new Point(20, 215);
|
||||||
checkNoOverdrive.Margin = new Padding(4, 3, 4, 3);
|
checkNoOverdrive.Margin = new Padding(4, 3, 4, 3);
|
||||||
checkNoOverdrive.Name = "checkNoOverdrive";
|
checkNoOverdrive.Name = "checkNoOverdrive";
|
||||||
checkNoOverdrive.Padding = new Padding(3);
|
checkNoOverdrive.Padding = new Padding(3);
|
||||||
@@ -1172,7 +1174,7 @@ namespace GHelper
|
|||||||
panelPower.Controls.Add(labelHibernateAfter);
|
panelPower.Controls.Add(labelHibernateAfter);
|
||||||
panelPower.Controls.Add(pictureHibernate);
|
panelPower.Controls.Add(pictureHibernate);
|
||||||
panelPower.Dock = DockStyle.Top;
|
panelPower.Dock = DockStyle.Top;
|
||||||
panelPower.Location = new Point(15, 1225);
|
panelPower.Location = new Point(15, 1267);
|
||||||
panelPower.Name = "panelPower";
|
panelPower.Name = "panelPower";
|
||||||
panelPower.Size = new Size(983, 54);
|
panelPower.Size = new Size(983, 54);
|
||||||
panelPower.TabIndex = 4;
|
panelPower.TabIndex = 4;
|
||||||
@@ -1209,6 +1211,19 @@ namespace GHelper
|
|||||||
pictureHibernate.TabIndex = 22;
|
pictureHibernate.TabIndex = 22;
|
||||||
pictureHibernate.TabStop = false;
|
pictureHibernate.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// checkBootSound
|
||||||
|
//
|
||||||
|
checkBootSound.AutoSize = true;
|
||||||
|
checkBootSound.Dock = DockStyle.Top;
|
||||||
|
checkBootSound.Location = new Point(20, 173);
|
||||||
|
checkBootSound.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
checkBootSound.Name = "checkBootSound";
|
||||||
|
checkBootSound.Padding = new Padding(3);
|
||||||
|
checkBootSound.Size = new Size(952, 42);
|
||||||
|
checkBootSound.TabIndex = 10;
|
||||||
|
checkBootSound.Text = "Boot Sound";
|
||||||
|
checkBootSound.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// Extra
|
// Extra
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
@@ -1356,5 +1371,6 @@ namespace GHelper
|
|||||||
private NumericUpDown numericHibernateAfter;
|
private NumericUpDown numericHibernateAfter;
|
||||||
private CheckBox checkGPUFix;
|
private CheckBox checkGPUFix;
|
||||||
private ToolTip toolTip;
|
private ToolTip toolTip;
|
||||||
|
private CheckBox checkBootSound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,6 +108,7 @@ namespace GHelper
|
|||||||
checkSleep.Text = Properties.Strings.Sleep;
|
checkSleep.Text = Properties.Strings.Sleep;
|
||||||
checkBoot.Text = Properties.Strings.Boot;
|
checkBoot.Text = Properties.Strings.Boot;
|
||||||
checkShutdown.Text = Properties.Strings.Shutdown;
|
checkShutdown.Text = Properties.Strings.Shutdown;
|
||||||
|
checkBootSound.Text = Properties.Strings.BootSound;
|
||||||
|
|
||||||
labelSpeed.Text = Properties.Strings.AnimationSpeed;
|
labelSpeed.Text = Properties.Strings.AnimationSpeed;
|
||||||
//labelBrightness.Text = Properties.Strings.Brightness;
|
//labelBrightness.Text = Properties.Strings.Brightness;
|
||||||
@@ -311,6 +312,9 @@ namespace GHelper
|
|||||||
checkGpuApps.Checked = AppConfig.Is("kill_gpu_apps");
|
checkGpuApps.Checked = AppConfig.Is("kill_gpu_apps");
|
||||||
checkGpuApps.CheckedChanged += CheckGpuApps_CheckedChanged;
|
checkGpuApps.CheckedChanged += CheckGpuApps_CheckedChanged;
|
||||||
|
|
||||||
|
checkBootSound.Checked = (Program.acpi.DeviceGet(AsusACPI.BootSound) == 1);
|
||||||
|
checkBootSound.CheckedChanged += CheckBootSound_CheckedChanged;
|
||||||
|
|
||||||
pictureHelp.Click += PictureHelp_Click;
|
pictureHelp.Click += PictureHelp_Click;
|
||||||
buttonServices.Click += ButtonServices_Click;
|
buttonServices.Click += ButtonServices_Click;
|
||||||
|
|
||||||
@@ -327,6 +331,11 @@ namespace GHelper
|
|||||||
InitHibernate();
|
InitHibernate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckBootSound_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.BootSound, (checkBootSound.Checked ? 1 : 0), "BootSound");
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckGPUFix_CheckedChanged(object? sender, EventArgs e)
|
private void CheckGPUFix_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("gpu_fix", (checkGPUFix.Checked ? 1 : 0));
|
AppConfig.Set("gpu_fix", (checkGPUFix.Checked ? 1 : 0));
|
||||||
|
|||||||
211
app/Fans.Designer.cs
generated
211
app/Fans.Designer.cs
generated
@@ -31,14 +31,14 @@ namespace GHelper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
ChartArea chartArea9 = new ChartArea();
|
ChartArea chartArea1 = new ChartArea();
|
||||||
Title title9 = new Title();
|
Title title1 = new Title();
|
||||||
ChartArea chartArea10 = new ChartArea();
|
ChartArea chartArea2 = new ChartArea();
|
||||||
Title title10 = new Title();
|
Title title2 = new Title();
|
||||||
ChartArea chartArea11 = new ChartArea();
|
ChartArea chartArea3 = new ChartArea();
|
||||||
Title title11 = new Title();
|
Title title3 = new Title();
|
||||||
ChartArea chartArea12 = new ChartArea();
|
ChartArea chartArea4 = new ChartArea();
|
||||||
Title title12 = new Title();
|
Title title4 = new Title();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Fans));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Fans));
|
||||||
panelFans = new Panel();
|
panelFans = new Panel();
|
||||||
labelTip = new Label();
|
labelTip = new Label();
|
||||||
@@ -55,6 +55,7 @@ namespace GHelper
|
|||||||
picturePerf = new PictureBox();
|
picturePerf = new PictureBox();
|
||||||
labelFans = new Label();
|
labelFans = new Label();
|
||||||
panelApplyFans = new Panel();
|
panelApplyFans = new Panel();
|
||||||
|
buttonCalibrate = new RButton();
|
||||||
labelFansResult = new Label();
|
labelFansResult = new Label();
|
||||||
checkApplyFans = new RCheckBox();
|
checkApplyFans = new RCheckBox();
|
||||||
buttonReset = new RButton();
|
buttonReset = new RButton();
|
||||||
@@ -128,6 +129,10 @@ namespace GHelper
|
|||||||
labelGPUCore = new Label();
|
labelGPUCore = new Label();
|
||||||
trackGPUCore = new TrackBar();
|
trackGPUCore = new TrackBar();
|
||||||
labelGPUCoreTitle = new Label();
|
labelGPUCoreTitle = new Label();
|
||||||
|
panelGPUClockLimit = new Panel();
|
||||||
|
labelGPUClockLimit = new Label();
|
||||||
|
trackGPUClockLimit = new TrackBar();
|
||||||
|
labelGPUClockLimitTitle = new Label();
|
||||||
panelTitleGPU = new Panel();
|
panelTitleGPU = new Panel();
|
||||||
pictureGPU = new PictureBox();
|
pictureGPU = new PictureBox();
|
||||||
labelGPU = new Label();
|
labelGPU = new Label();
|
||||||
@@ -136,10 +141,6 @@ namespace GHelper
|
|||||||
buttonAdvanced = new RButton();
|
buttonAdvanced = new RButton();
|
||||||
buttonGPU = new RButton();
|
buttonGPU = new RButton();
|
||||||
buttonCPU = new RButton();
|
buttonCPU = new RButton();
|
||||||
panelGPUClockLimit = new Panel();
|
|
||||||
labelGPUClockLimit = new Label();
|
|
||||||
trackGPUClockLimit = new TrackBar();
|
|
||||||
labelGPUClockLimitTitle = new Label();
|
|
||||||
panelFans.SuspendLayout();
|
panelFans.SuspendLayout();
|
||||||
tableFanCharts.SuspendLayout();
|
tableFanCharts.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||||
@@ -188,12 +189,12 @@ namespace GHelper
|
|||||||
((System.ComponentModel.ISupportInitialize)trackGPUMemory).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackGPUMemory).BeginInit();
|
||||||
panelGPUCore.SuspendLayout();
|
panelGPUCore.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackGPUCore).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackGPUCore).BeginInit();
|
||||||
|
panelGPUClockLimit.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).BeginInit();
|
||||||
panelTitleGPU.SuspendLayout();
|
panelTitleGPU.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
||||||
panelNav.SuspendLayout();
|
panelNav.SuspendLayout();
|
||||||
tableNav.SuspendLayout();
|
tableNav.SuspendLayout();
|
||||||
panelGPUClockLimit.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).BeginInit();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// panelFans
|
// panelFans
|
||||||
@@ -239,7 +240,7 @@ namespace GHelper
|
|||||||
tableFanCharts.Location = new Point(0, 66);
|
tableFanCharts.Location = new Point(0, 66);
|
||||||
tableFanCharts.Margin = new Padding(4);
|
tableFanCharts.Margin = new Padding(4);
|
||||||
tableFanCharts.Name = "tableFanCharts";
|
tableFanCharts.Name = "tableFanCharts";
|
||||||
tableFanCharts.Padding = new Padding(10, 0, 10, 10);
|
tableFanCharts.Padding = new Padding(10, 0, 10, 5);
|
||||||
tableFanCharts.RowCount = 2;
|
tableFanCharts.RowCount = 2;
|
||||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||||
@@ -250,60 +251,60 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
// chartGPU
|
// chartGPU
|
||||||
//
|
//
|
||||||
chartArea9.Name = "ChartArea1";
|
chartArea1.Name = "ChartArea1";
|
||||||
chartGPU.ChartAreas.Add(chartArea9);
|
chartGPU.ChartAreas.Add(chartArea1);
|
||||||
chartGPU.Dock = DockStyle.Fill;
|
chartGPU.Dock = DockStyle.Fill;
|
||||||
chartGPU.Location = new Point(12, 491);
|
chartGPU.Location = new Point(12, 493);
|
||||||
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
chartGPU.Name = "chartGPU";
|
chartGPU.Name = "chartGPU";
|
||||||
chartGPU.Size = new Size(782, 461);
|
chartGPU.Size = new Size(782, 463);
|
||||||
chartGPU.TabIndex = 17;
|
chartGPU.TabIndex = 17;
|
||||||
chartGPU.Text = "chartGPU";
|
chartGPU.Text = "chartGPU";
|
||||||
title9.Name = "Title1";
|
title1.Name = "Title1";
|
||||||
chartGPU.Titles.Add(title9);
|
chartGPU.Titles.Add(title1);
|
||||||
//
|
//
|
||||||
// chartCPU
|
// chartCPU
|
||||||
//
|
//
|
||||||
chartArea10.Name = "ChartArea1";
|
chartArea2.Name = "ChartArea1";
|
||||||
chartCPU.ChartAreas.Add(chartArea10);
|
chartCPU.ChartAreas.Add(chartArea2);
|
||||||
chartCPU.Dock = DockStyle.Fill;
|
chartCPU.Dock = DockStyle.Fill;
|
||||||
chartCPU.Location = new Point(12, 10);
|
chartCPU.Location = new Point(12, 10);
|
||||||
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
chartCPU.Name = "chartCPU";
|
chartCPU.Name = "chartCPU";
|
||||||
chartCPU.Size = new Size(782, 461);
|
chartCPU.Size = new Size(782, 463);
|
||||||
chartCPU.TabIndex = 14;
|
chartCPU.TabIndex = 14;
|
||||||
chartCPU.Text = "chartCPU";
|
chartCPU.Text = "chartCPU";
|
||||||
title10.Name = "Title1";
|
title2.Name = "Title1";
|
||||||
chartCPU.Titles.Add(title10);
|
chartCPU.Titles.Add(title2);
|
||||||
//
|
//
|
||||||
// chartXGM
|
// chartXGM
|
||||||
//
|
//
|
||||||
chartArea11.Name = "ChartAreaXGM";
|
chartArea3.Name = "ChartAreaXGM";
|
||||||
chartXGM.ChartAreas.Add(chartArea11);
|
chartXGM.ChartAreas.Add(chartArea3);
|
||||||
chartXGM.Dock = DockStyle.Fill;
|
chartXGM.Dock = DockStyle.Fill;
|
||||||
chartXGM.Location = new Point(12, 1453);
|
chartXGM.Location = new Point(12, 1459);
|
||||||
chartXGM.Margin = new Padding(2, 10, 2, 10);
|
chartXGM.Margin = new Padding(2, 10, 2, 10);
|
||||||
chartXGM.Name = "chartXGM";
|
chartXGM.Name = "chartXGM";
|
||||||
chartXGM.Size = new Size(782, 464);
|
chartXGM.Size = new Size(782, 463);
|
||||||
chartXGM.TabIndex = 14;
|
chartXGM.TabIndex = 14;
|
||||||
chartXGM.Text = "chartXGM";
|
chartXGM.Text = "chartXGM";
|
||||||
title11.Name = "Title4";
|
title3.Name = "Title4";
|
||||||
chartXGM.Titles.Add(title11);
|
chartXGM.Titles.Add(title3);
|
||||||
chartXGM.Visible = false;
|
chartXGM.Visible = false;
|
||||||
//
|
//
|
||||||
// chartMid
|
// chartMid
|
||||||
//
|
//
|
||||||
chartArea12.Name = "ChartArea3";
|
chartArea4.Name = "ChartArea3";
|
||||||
chartMid.ChartAreas.Add(chartArea12);
|
chartMid.ChartAreas.Add(chartArea4);
|
||||||
chartMid.Dock = DockStyle.Fill;
|
chartMid.Dock = DockStyle.Fill;
|
||||||
chartMid.Location = new Point(12, 972);
|
chartMid.Location = new Point(12, 976);
|
||||||
chartMid.Margin = new Padding(2, 10, 2, 10);
|
chartMid.Margin = new Padding(2, 10, 2, 10);
|
||||||
chartMid.Name = "chartMid";
|
chartMid.Name = "chartMid";
|
||||||
chartMid.Size = new Size(782, 461);
|
chartMid.Size = new Size(782, 463);
|
||||||
chartMid.TabIndex = 14;
|
chartMid.TabIndex = 14;
|
||||||
chartMid.Text = "chartMid";
|
chartMid.Text = "chartMid";
|
||||||
title12.Name = "Title3";
|
title4.Name = "Title3";
|
||||||
chartMid.Titles.Add(title12);
|
chartMid.Titles.Add(title4);
|
||||||
chartMid.Visible = false;
|
chartMid.Visible = false;
|
||||||
//
|
//
|
||||||
// panelTitleFans
|
// panelTitleFans
|
||||||
@@ -410,6 +411,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
// panelApplyFans
|
// panelApplyFans
|
||||||
//
|
//
|
||||||
|
panelApplyFans.Controls.Add(buttonCalibrate);
|
||||||
panelApplyFans.Controls.Add(labelFansResult);
|
panelApplyFans.Controls.Add(labelFansResult);
|
||||||
panelApplyFans.Controls.Add(checkApplyFans);
|
panelApplyFans.Controls.Add(checkApplyFans);
|
||||||
panelApplyFans.Controls.Add(buttonReset);
|
panelApplyFans.Controls.Add(buttonReset);
|
||||||
@@ -420,16 +422,32 @@ namespace GHelper
|
|||||||
panelApplyFans.Size = new Size(806, 116);
|
panelApplyFans.Size = new Size(806, 116);
|
||||||
panelApplyFans.TabIndex = 43;
|
panelApplyFans.TabIndex = 43;
|
||||||
//
|
//
|
||||||
|
// buttonCalibrate
|
||||||
|
//
|
||||||
|
buttonCalibrate.Activated = false;
|
||||||
|
buttonCalibrate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCalibrate.BackColor = SystemColors.ControlLight;
|
||||||
|
buttonCalibrate.BorderColor = Color.Transparent;
|
||||||
|
buttonCalibrate.BorderRadius = 2;
|
||||||
|
buttonCalibrate.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonCalibrate.Location = new Point(239, 40);
|
||||||
|
buttonCalibrate.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
buttonCalibrate.Name = "buttonCalibrate";
|
||||||
|
buttonCalibrate.Secondary = true;
|
||||||
|
buttonCalibrate.Size = new Size(141, 50);
|
||||||
|
buttonCalibrate.TabIndex = 43;
|
||||||
|
buttonCalibrate.Text = "Calibrate";
|
||||||
|
buttonCalibrate.UseVisualStyleBackColor = false;
|
||||||
|
//
|
||||||
// labelFansResult
|
// labelFansResult
|
||||||
//
|
//
|
||||||
labelFansResult.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
labelFansResult.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
labelFansResult.ForeColor = Color.Red;
|
labelFansResult.ForeColor = Color.Red;
|
||||||
labelFansResult.Location = new Point(24, 4);
|
labelFansResult.Location = new Point(18, 2);
|
||||||
labelFansResult.Margin = new Padding(4, 0, 4, 0);
|
labelFansResult.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelFansResult.Name = "labelFansResult";
|
labelFansResult.Name = "labelFansResult";
|
||||||
labelFansResult.Size = new Size(762, 32);
|
labelFansResult.Size = new Size(771, 32);
|
||||||
labelFansResult.TabIndex = 42;
|
labelFansResult.TabIndex = 42;
|
||||||
labelFansResult.TextAlign = ContentAlignment.TopRight;
|
|
||||||
labelFansResult.Visible = false;
|
labelFansResult.Visible = false;
|
||||||
//
|
//
|
||||||
// checkApplyFans
|
// checkApplyFans
|
||||||
@@ -458,7 +476,7 @@ namespace GHelper
|
|||||||
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonReset.Name = "buttonReset";
|
buttonReset.Name = "buttonReset";
|
||||||
buttonReset.Secondary = true;
|
buttonReset.Secondary = true;
|
||||||
buttonReset.Size = new Size(274, 50);
|
buttonReset.Size = new Size(216, 50);
|
||||||
buttonReset.TabIndex = 18;
|
buttonReset.TabIndex = 18;
|
||||||
buttonReset.Text = Properties.Strings.FactoryDefaults;
|
buttonReset.Text = Properties.Strings.FactoryDefaults;
|
||||||
buttonReset.UseVisualStyleBackColor = false;
|
buttonReset.UseVisualStyleBackColor = false;
|
||||||
@@ -1337,6 +1355,56 @@ namespace GHelper
|
|||||||
labelGPUCoreTitle.TabIndex = 17;
|
labelGPUCoreTitle.TabIndex = 17;
|
||||||
labelGPUCoreTitle.Text = "Core Clock Offset";
|
labelGPUCoreTitle.Text = "Core Clock Offset";
|
||||||
//
|
//
|
||||||
|
// panelGPUClockLimit
|
||||||
|
//
|
||||||
|
panelGPUClockLimit.AutoSize = true;
|
||||||
|
panelGPUClockLimit.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
|
panelGPUClockLimit.Controls.Add(labelGPUClockLimit);
|
||||||
|
panelGPUClockLimit.Controls.Add(trackGPUClockLimit);
|
||||||
|
panelGPUClockLimit.Controls.Add(labelGPUClockLimitTitle);
|
||||||
|
panelGPUClockLimit.Dock = DockStyle.Top;
|
||||||
|
panelGPUClockLimit.Location = new Point(0, 60);
|
||||||
|
panelGPUClockLimit.Margin = new Padding(4);
|
||||||
|
panelGPUClockLimit.MaximumSize = new Size(0, 124);
|
||||||
|
panelGPUClockLimit.Name = "panelGPUClockLimit";
|
||||||
|
panelGPUClockLimit.Size = new Size(520, 124);
|
||||||
|
panelGPUClockLimit.TabIndex = 48;
|
||||||
|
//
|
||||||
|
// labelGPUClockLimit
|
||||||
|
//
|
||||||
|
labelGPUClockLimit.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelGPUClockLimit.Location = new Point(326, 16);
|
||||||
|
labelGPUClockLimit.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelGPUClockLimit.Name = "labelGPUClockLimit";
|
||||||
|
labelGPUClockLimit.Size = new Size(176, 32);
|
||||||
|
labelGPUClockLimit.TabIndex = 29;
|
||||||
|
labelGPUClockLimit.Text = "1500 MHz";
|
||||||
|
labelGPUClockLimit.TextAlign = ContentAlignment.TopRight;
|
||||||
|
//
|
||||||
|
// trackGPUClockLimit
|
||||||
|
//
|
||||||
|
trackGPUClockLimit.LargeChange = 100;
|
||||||
|
trackGPUClockLimit.Location = new Point(6, 48);
|
||||||
|
trackGPUClockLimit.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
trackGPUClockLimit.Maximum = 3000;
|
||||||
|
trackGPUClockLimit.Name = "trackGPUClockLimit";
|
||||||
|
trackGPUClockLimit.RightToLeft = RightToLeft.No;
|
||||||
|
trackGPUClockLimit.Size = new Size(496, 90);
|
||||||
|
trackGPUClockLimit.SmallChange = 10;
|
||||||
|
trackGPUClockLimit.TabIndex = 18;
|
||||||
|
trackGPUClockLimit.TickFrequency = 50;
|
||||||
|
trackGPUClockLimit.TickStyle = TickStyle.TopLeft;
|
||||||
|
//
|
||||||
|
// labelGPUClockLimitTitle
|
||||||
|
//
|
||||||
|
labelGPUClockLimitTitle.AutoSize = true;
|
||||||
|
labelGPUClockLimitTitle.Location = new Point(10, 16);
|
||||||
|
labelGPUClockLimitTitle.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelGPUClockLimitTitle.Name = "labelGPUClockLimitTitle";
|
||||||
|
labelGPUClockLimitTitle.Size = new Size(188, 32);
|
||||||
|
labelGPUClockLimitTitle.TabIndex = 17;
|
||||||
|
labelGPUClockLimitTitle.Text = "Core Clock Limit";
|
||||||
|
//
|
||||||
// panelTitleGPU
|
// panelTitleGPU
|
||||||
//
|
//
|
||||||
panelTitleGPU.AutoSize = true;
|
panelTitleGPU.AutoSize = true;
|
||||||
@@ -1459,56 +1527,6 @@ namespace GHelper
|
|||||||
buttonCPU.TextImageRelation = TextImageRelation.ImageBeforeText;
|
buttonCPU.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||||
buttonCPU.UseVisualStyleBackColor = false;
|
buttonCPU.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// panelGPUClockLimit
|
|
||||||
//
|
|
||||||
panelGPUClockLimit.AutoSize = true;
|
|
||||||
panelGPUClockLimit.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
panelGPUClockLimit.Controls.Add(labelGPUClockLimit);
|
|
||||||
panelGPUClockLimit.Controls.Add(trackGPUClockLimit);
|
|
||||||
panelGPUClockLimit.Controls.Add(labelGPUClockLimitTitle);
|
|
||||||
panelGPUClockLimit.Dock = DockStyle.Top;
|
|
||||||
panelGPUClockLimit.Location = new Point(0, 60);
|
|
||||||
panelGPUClockLimit.Margin = new Padding(4);
|
|
||||||
panelGPUClockLimit.MaximumSize = new Size(0, 124);
|
|
||||||
panelGPUClockLimit.Name = "panelGPUClockLimit";
|
|
||||||
panelGPUClockLimit.Size = new Size(520, 124);
|
|
||||||
panelGPUClockLimit.TabIndex = 48;
|
|
||||||
//
|
|
||||||
// labelGPUClockLimit
|
|
||||||
//
|
|
||||||
labelGPUClockLimit.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
|
||||||
labelGPUClockLimit.Location = new Point(326, 16);
|
|
||||||
labelGPUClockLimit.Margin = new Padding(4, 0, 4, 0);
|
|
||||||
labelGPUClockLimit.Name = "labelGPUClockLimit";
|
|
||||||
labelGPUClockLimit.Size = new Size(176, 32);
|
|
||||||
labelGPUClockLimit.TabIndex = 29;
|
|
||||||
labelGPUClockLimit.Text = "1500 MHz";
|
|
||||||
labelGPUClockLimit.TextAlign = ContentAlignment.TopRight;
|
|
||||||
//
|
|
||||||
// trackGPUClockLimit
|
|
||||||
//
|
|
||||||
trackGPUClockLimit.LargeChange = 100;
|
|
||||||
trackGPUClockLimit.Location = new Point(6, 48);
|
|
||||||
trackGPUClockLimit.Margin = new Padding(4, 2, 4, 2);
|
|
||||||
trackGPUClockLimit.Maximum = 3000;
|
|
||||||
trackGPUClockLimit.Name = "trackGPUClockLimit";
|
|
||||||
trackGPUClockLimit.RightToLeft = RightToLeft.No;
|
|
||||||
trackGPUClockLimit.Size = new Size(496, 90);
|
|
||||||
trackGPUClockLimit.SmallChange = 10;
|
|
||||||
trackGPUClockLimit.TabIndex = 18;
|
|
||||||
trackGPUClockLimit.TickFrequency = 50;
|
|
||||||
trackGPUClockLimit.TickStyle = TickStyle.TopLeft;
|
|
||||||
//
|
|
||||||
// labelGPUClockLimitTitle
|
|
||||||
//
|
|
||||||
labelGPUClockLimitTitle.AutoSize = true;
|
|
||||||
labelGPUClockLimitTitle.Location = new Point(10, 16);
|
|
||||||
labelGPUClockLimitTitle.Margin = new Padding(4, 0, 4, 0);
|
|
||||||
labelGPUClockLimitTitle.Name = "labelGPUClockLimitTitle";
|
|
||||||
labelGPUClockLimitTitle.Size = new Size(188, 32);
|
|
||||||
labelGPUClockLimitTitle.TabIndex = 17;
|
|
||||||
labelGPUClockLimitTitle.Text = "Core Clock Limit";
|
|
||||||
//
|
|
||||||
// Fans
|
// Fans
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
@@ -1597,14 +1615,14 @@ namespace GHelper
|
|||||||
panelGPUCore.ResumeLayout(false);
|
panelGPUCore.ResumeLayout(false);
|
||||||
panelGPUCore.PerformLayout();
|
panelGPUCore.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackGPUCore).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackGPUCore).EndInit();
|
||||||
|
panelGPUClockLimit.ResumeLayout(false);
|
||||||
|
panelGPUClockLimit.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).EndInit();
|
||||||
panelTitleGPU.ResumeLayout(false);
|
panelTitleGPU.ResumeLayout(false);
|
||||||
panelTitleGPU.PerformLayout();
|
panelTitleGPU.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
||||||
panelNav.ResumeLayout(false);
|
panelNav.ResumeLayout(false);
|
||||||
tableNav.ResumeLayout(false);
|
tableNav.ResumeLayout(false);
|
||||||
panelGPUClockLimit.ResumeLayout(false);
|
|
||||||
panelGPUClockLimit.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).EndInit();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -1711,5 +1729,6 @@ namespace GHelper
|
|||||||
private Label labelGPUClockLimit;
|
private Label labelGPUClockLimit;
|
||||||
private TrackBar trackGPUClockLimit;
|
private TrackBar trackGPUClockLimit;
|
||||||
private Label labelGPUClockLimitTitle;
|
private Label labelGPUClockLimitTitle;
|
||||||
|
private RButton buttonCalibrate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
132
app/Fans.cs
132
app/Fans.cs
@@ -18,8 +18,6 @@ namespace GHelper
|
|||||||
Series seriesMid;
|
Series seriesMid;
|
||||||
Series seriesXGM;
|
Series seriesXGM;
|
||||||
|
|
||||||
static int MinRPM, MaxRPM;
|
|
||||||
|
|
||||||
static bool gpuVisible = true;
|
static bool gpuVisible = true;
|
||||||
static bool fanRpm = true;
|
static bool fanRpm = true;
|
||||||
|
|
||||||
@@ -28,6 +26,8 @@ namespace GHelper
|
|||||||
NvidiaGpuControl? nvControl = null;
|
NvidiaGpuControl? nvControl = null;
|
||||||
ModeControl modeControl = Program.modeControl;
|
ModeControl modeControl = Program.modeControl;
|
||||||
|
|
||||||
|
public static System.Timers.Timer timer = default!;
|
||||||
|
|
||||||
public Fans()
|
public Fans()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ namespace GHelper
|
|||||||
buttonApplyAdvanced.Text = Properties.Strings.Apply;
|
buttonApplyAdvanced.Text = Properties.Strings.Apply;
|
||||||
checkApplyUV.Text = Properties.Strings.AutoApply;
|
checkApplyUV.Text = Properties.Strings.AutoApply;
|
||||||
|
|
||||||
|
buttonCalibrate.Text = Properties.Strings.Calibrate;
|
||||||
|
|
||||||
InitTheme(true);
|
InitTheme(true);
|
||||||
|
|
||||||
MinRPM = 18;
|
|
||||||
MaxRPM = HardwareControl.fanMax;
|
|
||||||
labelTip.Visible = false;
|
labelTip.Visible = false;
|
||||||
labelTip.BackColor = Color.Transparent;
|
labelTip.BackColor = Color.Transparent;
|
||||||
|
|
||||||
@@ -200,13 +200,98 @@ namespace GHelper
|
|||||||
|
|
||||||
checkApplyUV.Click += CheckApplyUV_Click;
|
checkApplyUV.Click += CheckApplyUV_Click;
|
||||||
|
|
||||||
|
timer = new System.Timers.Timer(1000);
|
||||||
|
timer.Elapsed += Timer_Elapsed;
|
||||||
|
buttonCalibrate.Click += ButtonCalibrate_Click;
|
||||||
|
|
||||||
ToggleNavigation(0);
|
ToggleNavigation(0);
|
||||||
|
|
||||||
FormClosed += Fans_FormClosed;
|
FormClosed += Fans_FormClosed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int FAN_COUNT = 3;
|
||||||
|
static int[] fanMax;
|
||||||
|
static int sameCount = 0;
|
||||||
|
|
||||||
|
private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
int fan;
|
||||||
|
bool same = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < FAN_COUNT; i++)
|
||||||
|
{
|
||||||
|
fan = Program.acpi.GetFan((AsusFan)i);
|
||||||
|
if (fan > fanMax[i])
|
||||||
|
{
|
||||||
|
fanMax[i] = fan;
|
||||||
|
same = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (same) sameCount++;
|
||||||
|
else sameCount = 0;
|
||||||
|
|
||||||
|
LabelFansResult("Max Speed - CPU: " + fanMax[(int)AsusFan.CPU] * 100 + ", GPU: " + fanMax[(int)AsusFan.GPU] * 100 + " (" + sameCount + "s)");
|
||||||
|
|
||||||
|
if (sameCount >= 15)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < FAN_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (fanMax[i] > 30 && fanMax[i] < 80) AppConfig.Set("fan_max_" + i, fanMax[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sameCount = 0;
|
||||||
|
CalibrateNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalibrateNext()
|
||||||
|
{
|
||||||
|
|
||||||
|
timer.Enabled = false;
|
||||||
|
modeControl.SetPerformanceMode();
|
||||||
|
|
||||||
|
string label = "Measured - CPU: " + AppConfig.Get("fan_max_" + (int)AsusFan.CPU) * 100;
|
||||||
|
|
||||||
|
if (AppConfig.Get("fan_max_" + (int)AsusFan.GPU) > 0)
|
||||||
|
label = label + ", GPU: " + AppConfig.Get("fan_max_" + (int)AsusFan.GPU) * 100;
|
||||||
|
|
||||||
|
if (AppConfig.Get("fan_max_" + (int)AsusFan.Mid) > 0)
|
||||||
|
label = label + ", Mid: " + AppConfig.Get("fan_max_" + (int)AsusFan.Mid) * 100;
|
||||||
|
|
||||||
|
LabelFansResult(label);
|
||||||
|
|
||||||
|
Invoke(delegate
|
||||||
|
{
|
||||||
|
buttonCalibrate.Enabled = true;
|
||||||
|
SetAxis(chartCPU, AsusFan.CPU);
|
||||||
|
SetAxis(chartGPU, AsusFan.GPU);
|
||||||
|
if (chartMid.Visible) SetAxis(chartMid, AsusFan.Mid);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCalibrate_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
fanMax = new int[] { 0, 0, 0 };
|
||||||
|
|
||||||
|
buttonCalibrate.Enabled = false;
|
||||||
|
timer.Enabled = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < FAN_COUNT; i++)
|
||||||
|
{
|
||||||
|
AppConfig.Remove("fan_max_" + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AsusACPI.PerformanceTurbo, "ModeCalibration");
|
||||||
|
|
||||||
|
for (int i = 0; i < FAN_COUNT; i++)
|
||||||
|
Program.acpi.SetFanCurve((AsusFan)i, new byte[] { 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 100, 100, 100, 100, 100, 100 });
|
||||||
|
}
|
||||||
|
|
||||||
private void ChartCPU_MouseClick(object? sender, MouseEventArgs e)
|
private void ChartCPU_MouseClick(object? sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null) return;
|
if (sender is null) return;
|
||||||
@@ -571,15 +656,17 @@ namespace GHelper
|
|||||||
VisualiseGPUSettings();
|
VisualiseGPUSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ChartPercToRPM(int percentage, AsusFan device, string unit = "")
|
static string ChartYLabel(int percentage, AsusFan device, string unit = "")
|
||||||
{
|
{
|
||||||
if (percentage == 0) return "OFF";
|
if (percentage == 0) return "OFF";
|
||||||
|
|
||||||
int Max = MaxRPM;
|
int Min = HardwareControl.DEFAULT_FAN_MIN;
|
||||||
|
int Max = AppConfig.Get("fan_max_" + (int)device, HardwareControl.DEFAULT_FAN_MAX);
|
||||||
|
|
||||||
if (device == AsusFan.XGM) Max = 72;
|
if (device == AsusFan.XGM) Max = 72;
|
||||||
|
|
||||||
if (fanRpm)
|
if (fanRpm)
|
||||||
return (200 * Math.Round((float)(MinRPM * 100 + (Max - MinRPM) * percentage) / 200)).ToString() + unit;
|
return (200 * Math.Round((float)(Min * 100 + (Max - Min) * percentage) / 200)).ToString() + unit;
|
||||||
else
|
else
|
||||||
return percentage + "%";
|
return percentage + "%";
|
||||||
}
|
}
|
||||||
@@ -589,12 +676,12 @@ namespace GHelper
|
|||||||
|
|
||||||
chart.ChartAreas[0].AxisY.CustomLabels.Clear();
|
chart.ChartAreas[0].AxisY.CustomLabels.Clear();
|
||||||
|
|
||||||
for (int i = 0; i <= fansMax - 10; i += 10)
|
for (int i = 0; i <= fansMax; i += 10)
|
||||||
{
|
{
|
||||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i, device));
|
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartYLabel(i, device));
|
||||||
}
|
}
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(fansMax - 2, fansMax + 2, Properties.Strings.RPM);
|
//chart.ChartAreas[0].AxisY.CustomLabels.Add(fansMax -2, fansMax + 2, Properties.Strings.RPM);
|
||||||
chart.ChartAreas[0].AxisY.Interval = 10;
|
chart.ChartAreas[0].AxisY.Interval = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,20 +689,21 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
string title = "";
|
string title = "";
|
||||||
|
string scale = ", RPM/°C";
|
||||||
|
|
||||||
switch (device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case AsusFan.CPU:
|
case AsusFan.CPU:
|
||||||
title = Properties.Strings.FanProfileCPU;
|
title = Properties.Strings.FanProfileCPU + scale;
|
||||||
break;
|
break;
|
||||||
case AsusFan.GPU:
|
case AsusFan.GPU:
|
||||||
title = Properties.Strings.FanProfileGPU;
|
title = Properties.Strings.FanProfileGPU + scale;
|
||||||
break;
|
break;
|
||||||
case AsusFan.Mid:
|
case AsusFan.Mid:
|
||||||
title = Properties.Strings.FanProfileMid;
|
title = Properties.Strings.FanProfileMid + scale;
|
||||||
break;
|
break;
|
||||||
case AsusFan.XGM:
|
case AsusFan.XGM:
|
||||||
title = "XG Mobile";
|
title = "XG Mobile" + scale;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,8 +812,11 @@ namespace GHelper
|
|||||||
|
|
||||||
public void LabelFansResult(string text)
|
public void LabelFansResult(string text)
|
||||||
{
|
{
|
||||||
labelFansResult.Text = text;
|
Invoke(delegate
|
||||||
labelFansResult.Visible = (text.Length > 0);
|
{
|
||||||
|
labelFansResult.Text = text;
|
||||||
|
labelFansResult.Visible = (text.Length > 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Fans_FormClosing(object? sender, FormClosingEventArgs e)
|
private void Fans_FormClosing(object? sender, FormClosingEventArgs e)
|
||||||
@@ -994,7 +1085,6 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
curPoint = null;
|
curPoint = null;
|
||||||
curIndex = -1;
|
curIndex = -1;
|
||||||
|
|
||||||
labelTip.Visible = false;
|
labelTip.Visible = false;
|
||||||
|
|
||||||
SaveProfile(seriesCPU, AsusFan.CPU);
|
SaveProfile(seriesCPU, AsusFan.CPU);
|
||||||
@@ -1017,7 +1107,9 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ChartCPU_MouseLeave(object? sender, EventArgs e)
|
private void ChartCPU_MouseLeave(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Chart_Save();
|
curPoint = null;
|
||||||
|
curIndex = -1;
|
||||||
|
labelTip.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e, AsusFan device)
|
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e, AsusFan device)
|
||||||
@@ -1081,7 +1173,7 @@ namespace GHelper
|
|||||||
tip = true;
|
tip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelTip.Text = Math.Round(curPoint.XValue) + "C, " + ChartPercToRPM((int)curPoint.YValues[0], device, " " + Properties.Strings.RPM);
|
labelTip.Text = Math.Round(curPoint.XValue) + "C, " + ChartYLabel((int)curPoint.YValues[0], device, " " + Properties.Strings.RPM);
|
||||||
labelTip.Top = e.Y + ((Control)sender).Top;
|
labelTip.Top = e.Y + ((Control)sender).Top;
|
||||||
labelTip.Left = e.X - 50;
|
labelTip.Left = e.X - 50;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.119</AssemblyVersion>
|
<AssemblyVersion>0.120</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ namespace GHelper.Gpu
|
|||||||
// GPU mode not supported
|
// GPU mode not supported
|
||||||
if (eco < 0 && mux < 0)
|
if (eco < 0 && mux < 0)
|
||||||
{
|
{
|
||||||
if (gpuExists is null)
|
if (gpuExists is null) gpuExists = Program.acpi.GetFan(AsusFan.GPU) >= 0;
|
||||||
gpuExists = HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is not null;
|
|
||||||
|
|
||||||
settings.HideGPUModes((bool)gpuExists);
|
settings.HideGPUModes((bool)gpuExists);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,7 +305,11 @@ namespace GHelper.Gpu
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Program.acpi.DeviceSet(AsusACPI.GPUXG, 1, "GPU XGM");
|
|
||||||
|
if (AppConfig.Is("xgm_special"))
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.GPUXG, 0x101, "GPU XGM");
|
||||||
|
else
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.GPUXG, 1, "GPU XGM");
|
||||||
|
|
||||||
InitXGM();
|
InitXGM();
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ using System.Management;
|
|||||||
public static class HardwareControl
|
public static class HardwareControl
|
||||||
{
|
{
|
||||||
|
|
||||||
const int DEFAULT_FAN_MAX = 58;
|
public const int DEFAULT_FAN_MIN = 18;
|
||||||
const int INADEQUATE_MAX = 80;
|
public const int DEFAULT_FAN_MAX = 58;
|
||||||
|
|
||||||
|
const int INADEQUATE_MAX = 72;
|
||||||
|
|
||||||
public static IGpuControl? GpuControl;
|
public static IGpuControl? GpuControl;
|
||||||
|
|
||||||
@@ -35,20 +37,17 @@ public static class HardwareControl
|
|||||||
|
|
||||||
static long lastUpdate;
|
static long lastUpdate;
|
||||||
|
|
||||||
static int _fanMax = DEFAULT_FAN_MAX;
|
static int[] _fanMax = new int[3] { DEFAULT_FAN_MAX, DEFAULT_FAN_MAX, DEFAULT_FAN_MAX };
|
||||||
static bool _fanRpm = false;
|
static bool _fanRpm = false;
|
||||||
|
|
||||||
public static int fanMax
|
public static int GetFanMax(AsusFan device)
|
||||||
{
|
{
|
||||||
get
|
return _fanMax[(int)device];
|
||||||
{
|
}
|
||||||
return _fanMax;
|
|
||||||
}
|
public static void SetFanMax(AsusFan device, int value)
|
||||||
set
|
{
|
||||||
{
|
AppConfig.Set("fan_max_" + (int)device, value);
|
||||||
AppConfig.Set("fan_max", value);
|
|
||||||
_fanMax = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool fanRpm
|
public static bool fanRpm
|
||||||
@@ -66,32 +65,32 @@ public static class HardwareControl
|
|||||||
|
|
||||||
static HardwareControl()
|
static HardwareControl()
|
||||||
{
|
{
|
||||||
_fanMax = AppConfig.Get("fan_max");
|
for (int i = 0; i < 3; i++)
|
||||||
if (_fanMax > INADEQUATE_MAX) _fanMax = -1; // skipping inadvequate settings
|
{
|
||||||
|
_fanMax[i] = AppConfig.Get("fan_max_" + i);
|
||||||
|
|
||||||
|
if (_fanMax[i] > INADEQUATE_MAX) _fanMax[i] = -1; // skipping inadvequate settings
|
||||||
|
|
||||||
|
if (_fanMax[i] < 0 && AppConfig.ContainsModel("401")) _fanMax[i] = 72;
|
||||||
|
if (_fanMax[i] < 0 && AppConfig.ContainsModel("503")) _fanMax[i] = 68;
|
||||||
|
if (_fanMax[i] < 0) _fanMax[i] = DEFAULT_FAN_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
if (_fanMax < 0 && AppConfig.ContainsModel("401")) _fanMax = 72;
|
|
||||||
if (_fanMax < 0 && AppConfig.ContainsModel("503")) _fanMax = 68;
|
|
||||||
if (_fanMax < 0) _fanMax = DEFAULT_FAN_MAX;
|
|
||||||
|
|
||||||
_fanRpm = AppConfig.IsNotFalse("fan_rpm");
|
_fanRpm = AppConfig.IsNotFalse("fan_rpm");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatFan(int fan)
|
public static string FormatFan(AsusFan device, int value)
|
||||||
{
|
{
|
||||||
// fix for old models
|
if (value < 0) return null;
|
||||||
if (fan < 0)
|
|
||||||
{
|
|
||||||
fan += 65536;
|
|
||||||
if (fan <= 0 || fan > 100) return null; //nothing reasonable
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fan > fanMax && fan <= INADEQUATE_MAX) fanMax = fan;
|
if (value > GetFanMax(device) && value <= INADEQUATE_MAX) SetFanMax(device, value);
|
||||||
|
|
||||||
if (fanRpm)
|
if (fanRpm)
|
||||||
return GHelper.Properties.Strings.FanSpeed + ": " + (fan * 100).ToString() + "RPM";
|
return GHelper.Properties.Strings.FanSpeed + ": " + (value * 100).ToString() + "RPM";
|
||||||
else
|
else
|
||||||
return GHelper.Properties.Strings.FanSpeed + ": " + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm
|
return GHelper.Properties.Strings.FanSpeed + ": " + Math.Min(Math.Round((float)value / GetFanMax(device) * 100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetGpuUse()
|
private static int GetGpuUse()
|
||||||
@@ -246,9 +245,9 @@ public static class HardwareControl
|
|||||||
gpuTemp = -1;
|
gpuTemp = -1;
|
||||||
gpuUse = -1;
|
gpuUse = -1;
|
||||||
|
|
||||||
cpuFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.CPU_Fan));
|
cpuFan = FormatFan(AsusFan.CPU, Program.acpi.GetFan(AsusFan.CPU));
|
||||||
gpuFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan));
|
gpuFan = FormatFan(AsusFan.GPU, Program.acpi.GetFan(AsusFan.GPU));
|
||||||
midFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.Mid_Fan));
|
midFan = FormatFan(AsusFan.Mid, Program.acpi.GetFan(AsusFan.Mid));
|
||||||
|
|
||||||
cpuTemp = GetCPUTemp();
|
cpuTemp = GetCPUTemp();
|
||||||
|
|
||||||
|
|||||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -610,6 +610,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] MFont {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("MFont", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -289,4 +289,7 @@
|
|||||||
<data name="icons8_rocket_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8_rocket_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MFont" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
18
app/Properties/Strings.Designer.cs
generated
18
app/Properties/Strings.Designer.cs
generated
@@ -483,6 +483,15 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Boot Sound.
|
||||||
|
/// </summary>
|
||||||
|
internal static string BootSound {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("BootSound", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Brightness.
|
/// Looks up a localized string similar to Brightness.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -510,6 +519,15 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Calibrate.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Calibrate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Calibrate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Charging.
|
/// Looks up a localized string similar to Charging.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
<value>Automatycznie ustaw odświeżanie 60 Hz w czasie pracy na baterii</value>
|
<value>Automatycznie ustaw odświeżanie 60 Hz w czasie pracy na baterii</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Awake" xml:space="preserve">
|
<data name="Awake" xml:space="preserve">
|
||||||
<value>Aktywność</value>
|
<value>Włączone</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="BacklightTimeout" xml:space="preserve">
|
<data name="BacklightTimeout" xml:space="preserve">
|
||||||
<value>Limit czasu podłączonego / na baterii (0 - Włączony)</value>
|
<value>Limit czasu podłączonego / na baterii (0 - Włączony)</value>
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
<value>Aktualizacje BIOS i sterowników</value>
|
<value>Aktualizacje BIOS i sterowników</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Boot" xml:space="preserve">
|
<data name="Boot" xml:space="preserve">
|
||||||
<value>Podczas uruchamiania</value>
|
<value>Uruchamianie</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Brightness" xml:space="preserve">
|
<data name="Brightness" xml:space="preserve">
|
||||||
<value>Jasność</value>
|
<value>Jasność</value>
|
||||||
|
|||||||
@@ -258,6 +258,9 @@
|
|||||||
<data name="Boot" xml:space="preserve">
|
<data name="Boot" xml:space="preserve">
|
||||||
<value>Boot</value>
|
<value>Boot</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="BootSound" xml:space="preserve">
|
||||||
|
<value>Boot Sound</value>
|
||||||
|
</data>
|
||||||
<data name="Brightness" xml:space="preserve">
|
<data name="Brightness" xml:space="preserve">
|
||||||
<value>Brightness</value>
|
<value>Brightness</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -267,6 +270,9 @@
|
|||||||
<data name="BrightnessUp" xml:space="preserve">
|
<data name="BrightnessUp" xml:space="preserve">
|
||||||
<value>Brightness Up</value>
|
<value>Brightness Up</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Calibrate" xml:space="preserve">
|
||||||
|
<value>Calibrate</value>
|
||||||
|
</data>
|
||||||
<data name="Charging" xml:space="preserve">
|
<data name="Charging" xml:space="preserve">
|
||||||
<value>Charging</value>
|
<value>Charging</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
BIN
app/Resources/Font.otf
Normal file
BIN
app/Resources/Font.otf
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -10,7 +10,6 @@ using GHelper.Peripherals;
|
|||||||
using GHelper.Peripherals.Mouse;
|
using GHelper.Peripherals.Mouse;
|
||||||
using GHelper.UI;
|
using GHelper.UI;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
@@ -544,6 +543,7 @@ namespace GHelper
|
|||||||
Invoke(delegate
|
Invoke(delegate
|
||||||
{
|
{
|
||||||
comboMatrixRunning.SelectedIndex = mode;
|
comboMatrixRunning.SelectedIndex = mode;
|
||||||
|
if (comboMatrix.SelectedIndex == 0) comboMatrix.SelectedIndex = 3;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
app/Updates.Designer.cs
generated
24
app/Updates.Designer.cs
generated
@@ -54,16 +54,17 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
tableBios.AutoSize = true;
|
tableBios.AutoSize = true;
|
||||||
tableBios.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
tableBios.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
tableBios.ColumnCount = 3;
|
tableBios.ColumnCount = 4;
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
|
||||||
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||||
tableBios.Dock = DockStyle.Top;
|
tableBios.Dock = DockStyle.Top;
|
||||||
tableBios.Location = new Point(20, 20);
|
tableBios.Location = new Point(20, 20);
|
||||||
tableBios.Margin = new Padding(4);
|
tableBios.Margin = new Padding(4);
|
||||||
tableBios.MinimumSize = new Size(1100, 0);
|
tableBios.MinimumSize = new Size(1300, 0);
|
||||||
tableBios.Name = "tableBios";
|
tableBios.Name = "tableBios";
|
||||||
tableBios.Size = new Size(1216, 0);
|
tableBios.Size = new Size(1300, 0);
|
||||||
tableBios.TabIndex = 0;
|
tableBios.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// labelBIOS
|
// labelBIOS
|
||||||
@@ -105,7 +106,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelUpdates.Location = new Point(941, 23);
|
labelUpdates.Location = new Point(810, 23);
|
||||||
labelUpdates.Name = "labelUpdates";
|
labelUpdates.Name = "labelUpdates";
|
||||||
labelUpdates.Size = new Size(245, 32);
|
labelUpdates.Size = new Size(245, 32);
|
||||||
labelUpdates.TabIndex = 4;
|
labelUpdates.TabIndex = 4;
|
||||||
@@ -156,16 +157,17 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
tableDrivers.AutoSize = true;
|
tableDrivers.AutoSize = true;
|
||||||
tableDrivers.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
tableDrivers.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
tableDrivers.ColumnCount = 3;
|
tableDrivers.ColumnCount = 4;
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
|
||||||
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||||
tableDrivers.Dock = DockStyle.Top;
|
tableDrivers.Dock = DockStyle.Top;
|
||||||
tableDrivers.Location = new Point(20, 20);
|
tableDrivers.Location = new Point(20, 20);
|
||||||
tableDrivers.Margin = new Padding(4);
|
tableDrivers.Margin = new Padding(4);
|
||||||
tableDrivers.MinimumSize = new Size(1100, 0);
|
tableDrivers.MinimumSize = new Size(1300, 0);
|
||||||
tableDrivers.Name = "tableDrivers";
|
tableDrivers.Name = "tableDrivers";
|
||||||
tableDrivers.Size = new Size(1216, 0);
|
tableDrivers.Size = new Size(1300, 0);
|
||||||
tableDrivers.TabIndex = 0;
|
tableDrivers.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// panelDriversTitle
|
// panelDriversTitle
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ namespace GHelper
|
|||||||
|
|
||||||
public partial class Updates : RForm
|
public partial class Updates : RForm
|
||||||
{
|
{
|
||||||
|
const int DRIVER_NOT_FOUND = 2;
|
||||||
|
const int DRIVER_NEWER = 1;
|
||||||
|
|
||||||
//static int rowCount = 0;
|
//static int rowCount = 0;
|
||||||
static string model;
|
static string model;
|
||||||
static string bios;
|
static string bios;
|
||||||
@@ -21,6 +24,7 @@ namespace GHelper
|
|||||||
public string title;
|
public string title;
|
||||||
public string version;
|
public string version;
|
||||||
public string downloadUrl;
|
public string downloadUrl;
|
||||||
|
public string date;
|
||||||
public JsonElement hardwares;
|
public JsonElement hardwares;
|
||||||
}
|
}
|
||||||
private void LoadUpdates(bool force = false)
|
private void LoadUpdates(bool force = false)
|
||||||
@@ -156,7 +160,8 @@ namespace GHelper
|
|||||||
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||||
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
|
||||||
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
|
||||||
table.Controls.Add(versionLabel, 2, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.date, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 2, table.RowCount);
|
||||||
|
table.Controls.Add(versionLabel, 3, table.RowCount);
|
||||||
table.RowCount++;
|
table.RowCount++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -171,15 +176,21 @@ namespace GHelper
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseNewDriver(int position, TableLayoutPanel table)
|
public void VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
|
||||||
{
|
{
|
||||||
var label = table.GetControlFromPosition(2, position) as Label;
|
var label = table.GetControlFromPosition(3, position) as Label;
|
||||||
if (label != null)
|
if (label != null)
|
||||||
{
|
{
|
||||||
Invoke(delegate
|
Invoke(delegate
|
||||||
{
|
{
|
||||||
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
|
if (newer == DRIVER_NEWER)
|
||||||
label.ForeColor = colorTurbo;
|
{
|
||||||
|
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
|
||||||
|
label.ForeColor = colorTurbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newer == DRIVER_NOT_FOUND) label.ForeColor = Color.Gray;
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,6 +248,7 @@ namespace GHelper
|
|||||||
driver.version = file.GetProperty("Version").ToString().Replace("V", "");
|
driver.version = file.GetProperty("Version").ToString().Replace("V", "");
|
||||||
driver.downloadUrl = file.GetProperty("DownloadUrl").GetProperty("Global").ToString();
|
driver.downloadUrl = file.GetProperty("DownloadUrl").GetProperty("Global").ToString();
|
||||||
driver.hardwares = file.GetProperty("HardwareInfoList");
|
driver.hardwares = file.GetProperty("HardwareInfoList");
|
||||||
|
driver.date = file.GetProperty("ReleaseDate").ToString();
|
||||||
drivers.Add(driver);
|
drivers.Add(driver);
|
||||||
|
|
||||||
VisualiseDriver(driver, table);
|
VisualiseDriver(driver, table);
|
||||||
@@ -257,26 +269,28 @@ namespace GHelper
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (var driver in drivers)
|
foreach (var driver in drivers)
|
||||||
{
|
{
|
||||||
int newer = -2;
|
int newer = DRIVER_NOT_FOUND;
|
||||||
if (type == 0 && driver.hardwares.ToString().Length > 0)
|
if (type == 0 && driver.hardwares.ToString().Length > 0)
|
||||||
for (int k = 0; k < driver.hardwares.GetArrayLength(); k++)
|
for (int k = 0; k < driver.hardwares.GetArrayLength(); k++)
|
||||||
{
|
{
|
||||||
var deviceID = driver.hardwares[k].GetProperty("hardwareid").ToString();
|
var deviceID = driver.hardwares[k].GetProperty("hardwareid").ToString();
|
||||||
var localVersion = devices.Where(p => p.Key.Contains(deviceID)).Select(p => p.Value).FirstOrDefault();
|
var localVersions = devices.Where(p => p.Key.Contains(deviceID)).Select(p => p.Value);
|
||||||
if (localVersion is not null)
|
foreach (var localVersion in localVersions)
|
||||||
{
|
{
|
||||||
newer = new Version(driver.version).CompareTo(new Version(localVersion));
|
newer = Math.Min(newer, new Version(driver.version).CompareTo(new Version(localVersion)));
|
||||||
break;
|
Logger.WriteLine(driver.title + " " + deviceID + " "+ driver.version + " vs " + localVersion + " = " + newer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
||||||
|
|
||||||
if (newer > 0)
|
VisualiseNewDriver(count, newer, table);
|
||||||
|
|
||||||
|
if (newer == DRIVER_NEWER)
|
||||||
{
|
{
|
||||||
updatesCount++;
|
updatesCount++;
|
||||||
VisualiseNewDriver(count, table);
|
|
||||||
VisualiseNewCount(updatesCount, table);
|
VisualiseNewCount(updatesCount, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -249,6 +249,13 @@ Example (for default windows "balanced" power plan):
|
|||||||
"scheme_2": "381b4222-f694-41f0-9685-ff5bb260df2e",
|
"scheme_2": "381b4222-f694-41f0-9685-ff5bb260df2e",
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Alternative Activation for XG Mobile 6850XT
|
||||||
|
If you experience situation when your XG Mobile doesn't work on full power when Activated. It's possible it needs "alternative" command to get activated.
|
||||||
|
To turn it on, add following line to config :
|
||||||
|
```
|
||||||
|
"xgm_special" : 1,
|
||||||
|
```
|
||||||
|
|
||||||
### Override UI theme
|
### Override UI theme
|
||||||
|
|
||||||
By default app would set UI theme from "app" theme in windows setting. You can override it to specific theme, or general windows theme
|
By default app would set UI theme from "app" theme in windows setting. You can override it to specific theme, or general windows theme
|
||||||
|
|||||||
Reference in New Issue
Block a user