Compare commits

...

4 Commits
v0.94 ... v0.95

Author SHA1 Message Date
Serge
bb5aeba9e7 Fix for GA402XI 2023-07-05 17:15:47 +02:00
Serge
2d4e794084 Added option to disable tablet mode switch in config 2023-07-05 14:55:52 +02:00
Serge
5f1c926527 Keyboard listener retry 2023-07-04 23:07:55 +02:00
Serge
dc40b317f8 Default temp limit 2023-07-04 16:47:44 +02:00
10 changed files with 49 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
// 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 Starlight.Communication; using GHelper.AnimeMatrix.Communication;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
using System.Globalization; using System.Globalization;

View File

@@ -1,9 +1,8 @@
// Source thanks to https://github.com/vddCore/Starlight :) // Source thanks to https://github.com/vddCore/Starlight :)
using Starlight.Communication.Platform; using GHelper.AnimeMatrix.Communication.Platform;
using System.Configuration;
namespace Starlight.Communication namespace GHelper.AnimeMatrix.Communication
{ {
public abstract class Device : IDisposable public abstract class Device : IDisposable
{ {

View File

@@ -1,6 +1,6 @@
// Source thanks to https://github.com/vddCore/Starlight :) // Source thanks to https://github.com/vddCore/Starlight :)
namespace Starlight.Communication namespace GHelper.AnimeMatrix.Communication
{ {
public abstract class Packet public abstract class Packet
{ {

View File

@@ -1,4 +1,4 @@
namespace Starlight.Communication.Platform namespace GHelper.AnimeMatrix.Communication.Platform
{ {
internal abstract class UsbProvider : IDisposable internal abstract class UsbProvider : IDisposable
{ {
@@ -13,7 +13,7 @@ namespace Starlight.Communication.Platform
public abstract void Set(byte[] data); public abstract void Set(byte[] data);
public abstract byte[] Get(byte[] data); public abstract byte[] Get(byte[] data);
public abstract void Dispose(); public abstract void Dispose();
} }
} }

View File

@@ -1,14 +1,14 @@
using System.ComponentModel; using System.ComponentModel;
using HidSharp; using HidSharp;
namespace Starlight.Communication.Platform namespace GHelper.AnimeMatrix.Communication.Platform
{ {
internal class WindowsUsbProvider : UsbProvider internal class WindowsUsbProvider : UsbProvider
{ {
protected HidDevice HidDevice { get; } protected HidDevice HidDevice { get; }
protected HidStream HidStream { get; } protected HidStream HidStream { get; }
public WindowsUsbProvider(ushort vendorId, ushort productId, int maxFeatureReportLength) public WindowsUsbProvider(ushort vendorId, ushort productId, int maxFeatureReportLength)
: base(vendorId, productId) : base(vendorId, productId)
{ {
try try
@@ -43,7 +43,7 @@ namespace Starlight.Communication.Platform
{ {
var outData = new byte[data.Length]; var outData = new byte[data.Length];
Array.Copy(data, outData, data.Length); Array.Copy(data, outData, data.Length);
WrapException(() => WrapException(() =>
{ {
HidStream.GetFeature(outData); HidStream.GetFeature(outData);
@@ -57,7 +57,7 @@ namespace Starlight.Communication.Platform
{ {
HidStream.Dispose(); HidStream.Dispose();
} }
private void WrapException(Action action) private void WrapException(Action action)
{ {
try try

View File

@@ -267,32 +267,33 @@ namespace GHelper
int igpuUV = Math.Max(trackUViGPU.Minimum, Math.Min(trackUViGPU.Maximum, AppConfig.GetMode("igpu_uv", 0))); int igpuUV = Math.Max(trackUViGPU.Minimum, Math.Min(trackUViGPU.Maximum, AppConfig.GetMode("igpu_uv", 0)));
int temp = AppConfig.GetMode("cpu_temp"); int temp = AppConfig.GetMode("cpu_temp");
if (temp < trackTemp.Minimum || temp > trackTemp.Maximum) temp = 96; if (temp < RyzenControl.MinTemp || temp > RyzenControl.MaxTemp) temp = RyzenControl.MaxTemp;
checkApplyUV.Enabled = checkApplyUV.Checked = AppConfig.IsMode("auto_uv"); checkApplyUV.Enabled = checkApplyUV.Checked = AppConfig.IsMode("auto_uv");
trackUV.Value = cpuUV; trackUV.Value = cpuUV;
labelUV.Text = trackUV.Value.ToString();
trackUViGPU.Value = igpuUV; trackUViGPU.Value = igpuUV;
labelUViGPU.Text = trackUViGPU.Value.ToString();
trackTemp.Value = temp; trackTemp.Value = temp;
labelTemp.Text = trackTemp.Value.ToString() + "°C";
VisualiseAdvanced();
buttonAdvanced.Visible = RyzenControl.IsAMD(); buttonAdvanced.Visible = RyzenControl.IsAMD();
} }
private void VisualiseAdvanced()
{
labelUV.Text = trackUV.Value.ToString();
labelUViGPU.Text = trackUViGPU.Value.ToString();
labelTemp.Text = (trackTemp.Value < RyzenControl.MaxTemp) ? trackTemp.Value.ToString() + "°C" : "Default";
}
private void AdvancedScroll() private void AdvancedScroll()
{ {
AppConfig.SetMode("auto_uv", 0); AppConfig.SetMode("auto_uv", 0);
checkApplyUV.Enabled = checkApplyUV.Checked = false; checkApplyUV.Enabled = checkApplyUV.Checked = false;
labelUV.Text = trackUV.Value.ToString(); VisualiseAdvanced();
labelUViGPU.Text = trackUViGPU.Value.ToString();
labelTemp.Text = trackTemp.Value.ToString() + "°C";
AppConfig.SetMode("cpu_temp", trackTemp.Value); AppConfig.SetMode("cpu_temp", trackTemp.Value);
AppConfig.SetMode("cpu_uv", trackUV.Value); AppConfig.SetMode("cpu_uv", trackUV.Value);
@@ -839,10 +840,9 @@ namespace GHelper
AppConfig.SetMode("auto_apply", 0); AppConfig.SetMode("auto_apply", 0);
AppConfig.SetMode("auto_apply_power", 0); AppConfig.SetMode("auto_apply_power", 0);
trackUV.Value = RyzenControl.MaxCPUUV;
trackUV.Value = 0; trackUViGPU.Value = RyzenControl.MaxIGPUUV;
trackUViGPU.Value = 0; trackTemp.Value = RyzenControl.MaxTemp;
trackTemp.Value = 96;
AdvancedScroll(); AdvancedScroll();
AppConfig.SetMode("cpu_temp", -1); AppConfig.SetMode("cpu_temp", -1);

View File

@@ -16,7 +16,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.94</AssemblyVersion> <AssemblyVersion>0.95</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -12,7 +12,7 @@ namespace GHelper.Input
public class InputDispatcher public class InputDispatcher
{ {
System.Timers.Timer timer = new System.Timers.Timer(1000); System.Timers.Timer timer = new System.Timers.Timer(1000);
public bool backlightActivity = true; public static bool backlightActivity = true;
public static Keys keyProfile = Keys.F5; public static Keys keyProfile = Keys.F5;
public static Keys keyApp = Keys.F12; public static Keys keyApp = Keys.F12;
@@ -342,6 +342,8 @@ namespace GHelper.Input
public static void TabletMode() public static void TabletMode()
{ {
if (AppConfig.Is("disable_tablet")) return;
bool touchpadState = GetTouchpadState(); bool touchpadState = GetTouchpadState();
bool tabletState = Program.acpi.DeviceGet(AsusACPI.TabletState) > 0; bool tabletState = Program.acpi.DeviceGet(AsusACPI.TabletState) > 0;

View File

@@ -10,7 +10,20 @@ namespace GHelper.Input
public KeyboardListener(Action<int> KeyHandler) public KeyboardListener(Action<int> KeyHandler)
{ {
HidDevice? input = AsusUSB.GetDevice(); HidDevice? input = AsusUSB.GetDevice();
if (input == null) return;
// Fallback
if (input == null)
{
AsusUSB.Init();
Thread.Sleep(1000);
input = AsusUSB.GetDevice();
}
if (input == null)
{
Logger.WriteLine($"Input device not found");
return;
}
Logger.WriteLine($"Input: {input.DevicePath}"); Logger.WriteLine($"Input: {input.DevicePath}");

View File

@@ -171,6 +171,11 @@ namespace GHelper.Mode
AppConfig.ContainsModel("G733"); AppConfig.ContainsModel("G733");
} }
private static bool IsFanRequired()
{
return AppConfig.ContainsModel("GA402XI") || AppConfig.ContainsModel("G513");
}
public void AutoPower(int delay = 0) public void AutoPower(int delay = 0)
{ {
@@ -182,8 +187,8 @@ namespace GHelper.Mode
if (applyPower) if (applyPower)
{ {
// force fan curve for misbehaving bios PPTs on G513 // force fan curve for misbehaving bios PPTs on some models
if (AppConfig.ContainsModel("G513") && !applyFans) if (!applyFans && IsFanRequired())
{ {
delay = 500; delay = 500;
AutoFans(true); AutoFans(true);
@@ -342,7 +347,7 @@ namespace GHelper.Mode
public void SetCPUTemp(int? cpuTemp, bool log = true) public void SetCPUTemp(int? cpuTemp, bool log = true)
{ {
if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp) if (cpuTemp >= RyzenControl.MinTemp && cpuTemp < RyzenControl.MaxTemp)
{ {
var resultCPU = SendCommand.set_tctl_temp((uint)cpuTemp); var resultCPU = SendCommand.set_tctl_temp((uint)cpuTemp);
if (log) Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}"); if (log) Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}");