Driver updater fix, new turbo boost modes

This commit is contained in:
Serge
2023-06-12 19:07:57 +02:00
parent 1cd9c30c4a
commit ac462b628f
4 changed files with 26 additions and 18 deletions

2
app/Fans.Designer.cs generated
View File

@@ -412,7 +412,7 @@ namespace GHelper
comboBoost.ButtonColor = Color.FromArgb(255, 255, 255); comboBoost.ButtonColor = Color.FromArgb(255, 255, 255);
comboBoost.DropDownStyle = ComboBoxStyle.DropDownList; comboBoost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoost.FormattingEnabled = true; comboBoost.FormattingEnabled = true;
comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive" }); comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive", "Aggressive at Guaranteed", "Efficient at Guaranteed" });
comboBoost.Location = new Point(226, 10); comboBoost.Location = new Point(226, 10);
comboBoost.Name = "comboBoost"; comboBoost.Name = "comboBoost";
comboBoost.Size = new Size(287, 40); comboBoost.Size = new Size(287, 40);

View File

@@ -242,21 +242,21 @@ namespace GHelper
case Keys.F7: case Keys.F7:
if (AppConfig.ContainsModel("TUF")) if (AppConfig.ContainsModel("TUF"))
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(-10) + "%", ToastIcon.BrightnessDown); Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(-10) + "%", ToastIcon.BrightnessDown);
HandleEvent(16); HandleOptimizationEvent(16);
break; break;
case Keys.F8: case Keys.F8:
if (AppConfig.ContainsModel("TUF")) if (AppConfig.ContainsModel("TUF"))
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(+10) + "%", ToastIcon.BrightnessUp); Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(+10) + "%", ToastIcon.BrightnessUp);
HandleEvent(32); HandleOptimizationEvent(32);
break; break;
case Keys.F9: case Keys.F9:
KeyboardHook.KeyWinPress(Keys.P); KeyboardHook.KeyWinPress(Keys.P);
break; break;
case Keys.F10: case Keys.F10:
HandleEvent(107); HandleOptimizationEvent(107);
break; break;
case Keys.F11: case Keys.F11:
HandleEvent(108); HandleOptimizationEvent(108);
break; break;
case Keys.F12: case Keys.F12:
KeyboardHook.KeyWinPress(Keys.A); KeyboardHook.KeyWinPress(Keys.A);
@@ -343,10 +343,10 @@ namespace GHelper
} }
break; break;
case "brightness_up": case "brightness_up":
HandleEvent(32); HandleOptimizationEvent(32);
break; break;
case "brightness_down": case "brightness_down":
HandleEvent(16); HandleOptimizationEvent(16);
break; break;
case "custom": case "custom":
CustomKey(name); CustomKey(name);
@@ -429,10 +429,17 @@ namespace GHelper
return; return;
} }
if (OptimizationService.IsRunning()) return; if (!OptimizationService.IsRunning())
HandleOptimizationEvent(EventID);
// Asus Optimization service Events // Asus Optimization service Events
}
static void HandleOptimizationEvent(int EventID)
{
switch (EventID) switch (EventID)
{ {
case 16: // FN+F7 case 16: // FN+F7
@@ -449,14 +456,7 @@ namespace GHelper
case 108: // FN+F11 case 108: // FN+F11
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep"); Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep");
break; break;
case 106: // Zephyrus DUO special key for turning on/off second display.
//Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_DUO_SecondDisplay, "SecondDisplay");
break;
case 75: // Zephyrus DUO special key for changing between arrows and pgup/pgdn
//Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_DUO_PgUpDn, "PgUpDown");
break;
} }
} }

View File

@@ -724,6 +724,14 @@ public class NativeMethods
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero); int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet)); Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
//Fallback scenario
if (iRet != 0)
{
Thread.Sleep(300);
iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
}
return iRet; return iRet;
} }

View File

@@ -145,7 +145,7 @@ namespace GHelper
driver.hardwares = file.GetProperty("HardwareInfoList"); driver.hardwares = file.GetProperty("HardwareInfoList");
drivers.Add(driver); drivers.Add(driver);
BeginInvoke(delegate Invoke(delegate
{ {
string versionText = driver.version.Replace("latest version at the ", ""); string versionText = driver.version.Replace("latest version at the ", "");
Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, AutoSize = true }; Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, AutoSize = true };
@@ -170,7 +170,7 @@ namespace GHelper
} }
} }
BeginInvoke(delegate Invoke(delegate
{ {
table.Visible = true; table.Visible = true;
ResumeLayout(false); ResumeLayout(false);
@@ -206,7 +206,7 @@ namespace GHelper
var label = table.GetControlFromPosition(2, count) as Label; var label = table.GetControlFromPosition(2, count) as Label;
if (label != null) if (label != null)
{ {
BeginInvoke(delegate Invoke(delegate
{ {
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold); label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.ForeColor = colorTurbo; label.ForeColor = colorTurbo;