From dc40b317f88c948c324a88e466900fe0d6fb99fc Mon Sep 17 00:00:00 2001
From: Serge <5920850+seerge@users.noreply.github.com>
Date: Tue, 4 Jul 2023 16:47:44 +0200
Subject: [PATCH] Default temp limit
---
app/AnimeMatrix/AnimeMatrixDevice.cs | 2 +-
app/{ => AnimeMatrix}/Communication/Device.cs | 5 ++--
app/{ => AnimeMatrix}/Communication/Packet.cs | 2 +-
.../Communication/Platform/UsbProvider.cs | 4 +--
.../Platform/WindowsUsbProvider.cs | 8 +++---
app/Fans.cs | 26 +++++++++----------
app/GHelper.csproj | 2 +-
app/Mode/ModeControl.cs | 4 +--
8 files changed, 26 insertions(+), 27 deletions(-)
rename app/{ => AnimeMatrix}/Communication/Device.cs (91%)
rename app/{ => AnimeMatrix}/Communication/Packet.cs (97%)
rename app/{ => AnimeMatrix}/Communication/Platform/UsbProvider.cs (89%)
rename app/{ => AnimeMatrix}/Communication/Platform/WindowsUsbProvider.cs (95%)
diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs
index 5f1812fb..c535cf77 100644
--- a/app/AnimeMatrix/AnimeMatrixDevice.cs
+++ b/app/AnimeMatrix/AnimeMatrixDevice.cs
@@ -1,6 +1,6 @@
// 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.Text;
using System.Globalization;
diff --git a/app/Communication/Device.cs b/app/AnimeMatrix/Communication/Device.cs
similarity index 91%
rename from app/Communication/Device.cs
rename to app/AnimeMatrix/Communication/Device.cs
index c73e91f4..453d3369 100644
--- a/app/Communication/Device.cs
+++ b/app/AnimeMatrix/Communication/Device.cs
@@ -1,9 +1,8 @@
// Source thanks to https://github.com/vddCore/Starlight :)
-using Starlight.Communication.Platform;
-using System.Configuration;
+using GHelper.AnimeMatrix.Communication.Platform;
-namespace Starlight.Communication
+namespace GHelper.AnimeMatrix.Communication
{
public abstract class Device : IDisposable
{
diff --git a/app/Communication/Packet.cs b/app/AnimeMatrix/Communication/Packet.cs
similarity index 97%
rename from app/Communication/Packet.cs
rename to app/AnimeMatrix/Communication/Packet.cs
index d743aa96..cbcd177a 100644
--- a/app/Communication/Packet.cs
+++ b/app/AnimeMatrix/Communication/Packet.cs
@@ -1,6 +1,6 @@
// Source thanks to https://github.com/vddCore/Starlight :)
-namespace Starlight.Communication
+namespace GHelper.AnimeMatrix.Communication
{
public abstract class Packet
{
diff --git a/app/Communication/Platform/UsbProvider.cs b/app/AnimeMatrix/Communication/Platform/UsbProvider.cs
similarity index 89%
rename from app/Communication/Platform/UsbProvider.cs
rename to app/AnimeMatrix/Communication/Platform/UsbProvider.cs
index c3394cf3..b7488b8c 100644
--- a/app/Communication/Platform/UsbProvider.cs
+++ b/app/AnimeMatrix/Communication/Platform/UsbProvider.cs
@@ -1,4 +1,4 @@
-namespace Starlight.Communication.Platform
+namespace GHelper.AnimeMatrix.Communication.Platform
{
internal abstract class UsbProvider : IDisposable
{
@@ -13,7 +13,7 @@ namespace Starlight.Communication.Platform
public abstract void Set(byte[] data);
public abstract byte[] Get(byte[] data);
-
+
public abstract void Dispose();
}
}
\ No newline at end of file
diff --git a/app/Communication/Platform/WindowsUsbProvider.cs b/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs
similarity index 95%
rename from app/Communication/Platform/WindowsUsbProvider.cs
rename to app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs
index 8933ca49..23d6415f 100644
--- a/app/Communication/Platform/WindowsUsbProvider.cs
+++ b/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs
@@ -1,14 +1,14 @@
using System.ComponentModel;
using HidSharp;
-namespace Starlight.Communication.Platform
+namespace GHelper.AnimeMatrix.Communication.Platform
{
internal class WindowsUsbProvider : UsbProvider
{
protected HidDevice HidDevice { get; }
protected HidStream HidStream { get; }
- public WindowsUsbProvider(ushort vendorId, ushort productId, int maxFeatureReportLength)
+ public WindowsUsbProvider(ushort vendorId, ushort productId, int maxFeatureReportLength)
: base(vendorId, productId)
{
try
@@ -43,7 +43,7 @@ namespace Starlight.Communication.Platform
{
var outData = new byte[data.Length];
Array.Copy(data, outData, data.Length);
-
+
WrapException(() =>
{
HidStream.GetFeature(outData);
@@ -57,7 +57,7 @@ namespace Starlight.Communication.Platform
{
HidStream.Dispose();
}
-
+
private void WrapException(Action action)
{
try
diff --git a/app/Fans.cs b/app/Fans.cs
index 883d2f07..ffcabe4a 100644
--- a/app/Fans.cs
+++ b/app/Fans.cs
@@ -267,32 +267,33 @@ namespace GHelper
int igpuUV = Math.Max(trackUViGPU.Minimum, Math.Min(trackUViGPU.Maximum, AppConfig.GetMode("igpu_uv", 0)));
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");
trackUV.Value = cpuUV;
- labelUV.Text = trackUV.Value.ToString();
-
trackUViGPU.Value = igpuUV;
- labelUViGPU.Text = trackUViGPU.Value.ToString();
-
trackTemp.Value = temp;
- labelTemp.Text = trackTemp.Value.ToString() + "°C";
+ VisualiseAdvanced();
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()
{
AppConfig.SetMode("auto_uv", 0);
checkApplyUV.Enabled = checkApplyUV.Checked = false;
- labelUV.Text = trackUV.Value.ToString();
- labelUViGPU.Text = trackUViGPU.Value.ToString();
- labelTemp.Text = trackTemp.Value.ToString() + "°C";
+ VisualiseAdvanced();
AppConfig.SetMode("cpu_temp", trackTemp.Value);
AppConfig.SetMode("cpu_uv", trackUV.Value);
@@ -839,10 +840,9 @@ namespace GHelper
AppConfig.SetMode("auto_apply", 0);
AppConfig.SetMode("auto_apply_power", 0);
-
- trackUV.Value = 0;
- trackUViGPU.Value = 0;
- trackTemp.Value = 96;
+ trackUV.Value = RyzenControl.MaxCPUUV;
+ trackUViGPU.Value = RyzenControl.MaxIGPUUV;
+ trackTemp.Value = RyzenControl.MaxTemp;
AdvancedScroll();
AppConfig.SetMode("cpu_temp", -1);
diff --git a/app/GHelper.csproj b/app/GHelper.csproj
index 13043e37..7e5db603 100644
--- a/app/GHelper.csproj
+++ b/app/GHelper.csproj
@@ -16,7 +16,7 @@
AnyCPU
False
True
- 0.94
+ 0.95
diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs
index 897a7486..d37cf341 100644
--- a/app/Mode/ModeControl.cs
+++ b/app/Mode/ModeControl.cs
@@ -342,10 +342,10 @@ namespace GHelper.Mode
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);
- if (log) Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}");
+ Logger.WriteLine($"CPU Temp: {cpuTemp} {resultCPU}");
var restultAPU = SendCommand.set_apu_skin_temp_limit((uint)cpuTemp);
if (log) Logger.WriteLine($"APU Temp: {cpuTemp} {restultAPU}");