Improved aura logging

This commit is contained in:
Serge
2023-05-09 16:05:57 +02:00
parent a4488fa93b
commit 41caaefc97
3 changed files with 17 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
using HidLibrary;
using OSD;
using System.Diagnostics;
using System.Windows.Forms;
namespace GHelper
{
@@ -197,15 +198,16 @@ namespace GHelper
{
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
foreach (HidDevice device in GetHidDevices(new int[] { 0x19b6 }))
var devices = GetHidDevices(new int[] { 0x19b6 });
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices)
{
device.OpenDevice();
device.Write(msg);
device.CloseDevice();
}
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
if (Program.config.ContainsModel("TUF"))
Program.wmi.TUFKeyboardBrightness(brightness);
}
@@ -216,18 +218,18 @@ namespace GHelper
byte[] msg = AuraDev19b6Extensions.ToBytes(flags.ToArray());
Debug.WriteLine(BitConverter.ToString(msg));
foreach (HidDevice device in GetHidDevices(new int[] { 0x19b6 }))
var devices = GetHidDevices(new int[] { 0x19b6 });
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices)
{
device.OpenDevice();
device.Write(msg);
device.CloseDevice();
}
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
//if (Program.config.ContainsModel("TUF"))
if (Program.config.ContainsModel("TUF"))
Program.wmi.TUFKeyboardPower(
flags.Contains(AuraDev19b6.AwakeKeyb),
flags.Contains(AuraDev19b6.BootKeyb),
@@ -273,7 +275,10 @@ namespace GHelper
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
foreach (HidDevice device in GetHidDevices(deviceIds))
var devices = GetHidDevices(deviceIds);
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices)
{
device.OpenDevice();
device.Write(msg);

View File

@@ -4,6 +4,7 @@ using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.GPU.Structures;
using NvAPIWrapper.Native.Interfaces.GPU;
using System.Diagnostics;
using System.Management;
using static NvAPIWrapper.Native.GPU.Structures.PerformanceStates20InfoV1;
namespace GHelper.Gpu;
@@ -46,7 +47,6 @@ public class NvidiaGpuControl : IGpuControl
}
public void GetClocks(out int core, out int memory, out string gpu)
{
PhysicalGPU internalGpu = _internalGpu!;
@@ -86,7 +86,7 @@ public class NvidiaGpuControl : IGpuControl
var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000));
var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000));
PerformanceStates20ClockEntryV1[] clocks = { coreClock , memoryClock};
PerformanceStates20ClockEntryV1[] clocks = { coreClock, memoryClock };
PerformanceStates20BaseVoltageEntryV1[] voltages = { };
PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) };

View File

@@ -948,7 +948,7 @@ namespace GHelper
SetGPUMode(ASUSWmi.GPUModeEco);
}
public void RefreshSensors(bool force = false)
public async void RefreshSensors(bool force = false)
{
if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;