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" }
|
||||
};
|
||||
}
|
||||
public static Dictionary<int, string> GetModes()
|
||||
{
|
||||
return new Dictionary<int, string>
|
||||
|
||||
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "Static" },
|
||||
{ 1, "Breathe" },
|
||||
@@ -81,6 +80,21 @@ namespace GHelper
|
||||
{ 3, "Rainbow" },
|
||||
{ 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>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.42</AssemblyVersion>
|
||||
<AssemblyVersion>0.43</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -31,43 +31,29 @@ public static class HardwareMonitor
|
||||
|
||||
public static void ReadSensors()
|
||||
{
|
||||
cpuTemp = -1;
|
||||
batteryDischarge = -1;
|
||||
|
||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_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);
|
||||
if (cpuTemp < 0)
|
||||
{
|
||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
ct.Dispose();
|
||||
}
|
||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
ct.Dispose();
|
||||
} catch
|
||||
{
|
||||
Logger.WriteLine("Failed reading CPU temp");
|
||||
}
|
||||
|
||||
try
|
||||
if (gpuTemp < 0) 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");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||
if (gpuTemp < 0)
|
||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||
if (GpuTemperatureProvider is null) RecreateGpuTemperatureProvider();
|
||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
@@ -76,6 +62,17 @@ public static class HardwareMonitor
|
||||
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() {
|
||||
|
||||
@@ -59,13 +59,10 @@ namespace GHelper
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
|
||||
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
||||
|
||||
var ds = settingsForm.Handle;
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||
|
||||
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
settingsForm.InitGPUMode();
|
||||
@@ -75,10 +72,10 @@ namespace GHelper
|
||||
settingsForm.SetStartupCheck(Startup.IsScheduled());
|
||||
|
||||
SetAutoModes();
|
||||
HardwareMonitor.RecreateGpuTemperatureProvider();
|
||||
|
||||
// Subscribing for system power change events
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
|
||||
|
||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace GHelper
|
||||
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
|
||||
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer = new System.Timers.Timer(1000);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
|
||||
// Subscribing for monitor power on events
|
||||
@@ -878,7 +878,7 @@ namespace GHelper
|
||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||
this.Activate();
|
||||
|
||||
aTimer.Interval = 300;
|
||||
//aTimer.Interval = 300;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
//RefreshSensors();
|
||||
|
||||
Reference in New Issue
Block a user