mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Removed unsupported aura modes for some models
This commit is contained in:
20
app/Aura.cs
20
app/Aura.cs
@@ -71,9 +71,8 @@ namespace GHelper
|
|||||||
{ 2, "Fast" }
|
{ 2, "Fast" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Dictionary<int, string> GetModes()
|
|
||||||
{
|
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
||||||
return new Dictionary<int, string>
|
|
||||||
{
|
{
|
||||||
{ 0, "Static" },
|
{ 0, "Static" },
|
||||||
{ 1, "Breathe" },
|
{ 1, "Breathe" },
|
||||||
@@ -81,6 +80,21 @@ namespace GHelper
|
|||||||
{ 3, "Rainbow" },
|
{ 3, "Rainbow" },
|
||||||
{ 10, "Strobe" },
|
{ 10, "Strobe" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static Dictionary<int, string> GetModes()
|
||||||
|
{
|
||||||
|
if (Program.config.ContainsModel("TUF"))
|
||||||
|
{
|
||||||
|
_modes.Remove(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Program.config.ContainsModel("401"))
|
||||||
|
{
|
||||||
|
_modes.Remove(2);
|
||||||
|
_modes.Remove(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.42</AssemblyVersion>
|
<AssemblyVersion>0.43</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -31,43 +31,29 @@ public static class HardwareMonitor
|
|||||||
|
|
||||||
public static void ReadSensors()
|
public static void ReadSensors()
|
||||||
{
|
{
|
||||||
cpuTemp = -1;
|
|
||||||
batteryDischarge = -1;
|
batteryDischarge = -1;
|
||||||
|
|
||||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||||
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
||||||
|
|
||||||
try
|
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
||||||
|
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||||
|
|
||||||
|
if (cpuTemp < 0) try
|
||||||
{
|
{
|
||||||
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||||
if (cpuTemp < 0)
|
cpuTemp = ct.NextValue() - 273;
|
||||||
{
|
ct.Dispose();
|
||||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
|
||||||
cpuTemp = ct.NextValue() - 273;
|
|
||||||
ct.Dispose();
|
|
||||||
}
|
|
||||||
} catch
|
} catch
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Failed reading CPU temp");
|
Logger.WriteLine("Failed reading CPU temp");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
if (gpuTemp < 0) try
|
||||||
{
|
{
|
||||||
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
if (GpuTemperatureProvider is null) RecreateGpuTemperatureProvider();
|
||||||
batteryDischarge = cb.NextValue() / 1000;
|
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||||
cb.Dispose();
|
|
||||||
|
|
||||||
} catch
|
|
||||||
{
|
|
||||||
Logger.WriteLine("Failed reading Battery discharge");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
|
||||||
if (gpuTemp < 0)
|
|
||||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
@@ -76,6 +62,17 @@ public static class HardwareMonitor
|
|||||||
Logger.WriteLine(ex.ToString());
|
Logger.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
||||||
|
batteryDischarge = cb.NextValue() / 1000;
|
||||||
|
cb.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Logger.WriteLine("Failed reading Battery discharge");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecreateGpuTemperatureProviderWithDelay() {
|
public static void RecreateGpuTemperatureProviderWithDelay() {
|
||||||
|
|||||||
@@ -59,13 +59,10 @@ namespace GHelper
|
|||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
|
||||||
|
|
||||||
var ds = settingsForm.Handle;
|
var ds = settingsForm.Handle;
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||||
|
|
||||||
|
|
||||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
settingsForm.InitGPUMode();
|
settingsForm.InitGPUMode();
|
||||||
@@ -75,10 +72,10 @@ namespace GHelper
|
|||||||
settingsForm.SetStartupCheck(Startup.IsScheduled());
|
settingsForm.SetStartupCheck(Startup.IsScheduled());
|
||||||
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
HardwareMonitor.RecreateGpuTemperatureProvider();
|
|
||||||
|
|
||||||
// Subscribing for system power change events
|
// Subscribing for system power change events
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
|
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||||
|
|
||||||
|
|
||||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace GHelper
|
|||||||
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
|
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
|
||||||
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||||
|
|
||||||
aTimer = new System.Timers.Timer(500);
|
aTimer = new System.Timers.Timer(1000);
|
||||||
aTimer.Elapsed += OnTimedEvent;
|
aTimer.Elapsed += OnTimedEvent;
|
||||||
|
|
||||||
// Subscribing for monitor power on events
|
// Subscribing for monitor power on events
|
||||||
@@ -878,7 +878,7 @@ namespace GHelper
|
|||||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||||
this.Activate();
|
this.Activate();
|
||||||
|
|
||||||
aTimer.Interval = 300;
|
//aTimer.Interval = 300;
|
||||||
aTimer.Enabled = true;
|
aTimer.Enabled = true;
|
||||||
|
|
||||||
//RefreshSensors();
|
//RefreshSensors();
|
||||||
|
|||||||
Reference in New Issue
Block a user