Backlight control fix

This commit is contained in:
Serge
2023-05-27 22:44:54 +02:00
parent 47d96aca61
commit 1cda822820
3 changed files with 15 additions and 38 deletions

View File

@@ -262,17 +262,20 @@ namespace GHelper
device.CloseDevice();
}
// Backup payload for old models
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
var devicesBackup = GetHidDevices(deviceIds, 0);
foreach (HidDevice device in devicesBackup)
if (AppConfig.ContainsModel("503"))
{
device.OpenDevice();
device.WriteFeatureData(msgBackup);
device.CloseDevice();
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
var devicesBackup = GetHidDevices(deviceIds, 0);
foreach (HidDevice device in devicesBackup)
{
device.OpenDevice();
device.WriteFeatureData(msgBackup);
device.CloseDevice();
}
}
}

View File

@@ -155,6 +155,7 @@ public static class HardwareControl
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}
@@ -164,11 +165,14 @@ public static class HardwareControl
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}
_gpuControl.Dispose();
GpuControl = null;
}
catch (Exception ex)
{

View File

@@ -221,36 +221,6 @@ namespace GHelper
Padding padding = new Padding(15, 5, 5, 5);
/*
TableLayoutPanel[] tables = { tablePerf, tableGPU };
string[] titles = { Properties.Strings.PerformanceMode, Properties.Strings.GPUMode};
int index = 0;
foreach (TableLayoutPanel table in tables)
{
var title = new ToolStripMenuItem(titles[index]);
title.Margin = padding;
title.Enabled = false;
contextMenuStrip.Items.Add(title);
foreach (Control control in table.Controls)
{
var button = control as RButton;
if (button != null && !button.Secondary && button.Enabled)
{
var menu = new ToolStripMenuItem(button.Text);
menu.Margin = padding;
menu.Checked = button.Activated;
menu.Click += delegate { button.PerformClick(); };
contextMenuStrip.Items.Add(menu);
}
}
contextMenuStrip.Items.Add("-");
index++;
}*/
var title = new ToolStripMenuItem(Properties.Strings.PerformanceMode);
title.Margin = padding;
title.Enabled = false;