Merge branch 'seerge:main' into asus-mouse-support

This commit is contained in:
IceStormNG
2023-07-23 18:38:00 +02:00
committed by GitHub
7 changed files with 129 additions and 82 deletions

View File

@@ -256,13 +256,13 @@ namespace GHelper
public static void ApplyBrightness(int brightness, string log = "Backlight")
{
if (AppConfig.ContainsModel("TUF"))
Program.acpi.TUFKeyboardBrightness(brightness);
Task.Run(async () =>
{
if (AppConfig.ContainsModel("TUF"))
Program.acpi.TUFKeyboardBrightness(brightness);
byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
@@ -309,6 +309,9 @@ namespace GHelper
public static void ApplyAuraPower()
{
Task.Run(async () =>
{
List<AuraDev19b6> flags = new();
@@ -361,6 +364,8 @@ namespace GHelper
flags.Contains(AuraDev19b6.SleepKeyb),
flags.Contains(AuraDev19b6.ShutdownKeyb));
});
}
@@ -372,6 +377,10 @@ namespace GHelper
SetColor(AppConfig.Get("aura_color"));
SetColor2(AppConfig.Get("aura_color2"));
Task.Run(async () =>
{
int _speed;
switch (Speed)
@@ -405,6 +414,7 @@ namespace GHelper
if (AppConfig.ContainsModel("TUF"))
Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed);
});
}

View File

@@ -238,7 +238,7 @@ namespace GHelper.Display
//Fallback scenario
if (iRet != 0)
{
Thread.Sleep(1000);
Thread.Sleep(500);
iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
}

View File

@@ -227,7 +227,7 @@ namespace GHelper
}
}
checkAutoToggleClamshellMode.Visible = clamshellControl.IsExternalDisplayConnected();
//checkAutoToggleClamshellMode.Visible = clamshellControl.IsExternalDisplayConnected();
checkAutoToggleClamshellMode.Checked = AppConfig.Is("toggle_clamshell_mode");
checkAutoToggleClamshellMode.CheckedChanged += checkAutoToggleClamshellMode_CheckedChanged;

View File

@@ -177,7 +177,7 @@ namespace GHelper.Gpu
{
bool GpuAuto = AppConfig.Is("gpu_auto");
bool ForceGPU = AppConfig.ContainsModel("503");
bool ForceGPU = AppConfig.ContainsModel("503") || AppConfig.Is("gpu_fix");
int GpuMode = AppConfig.Get("gpu_mode");
@@ -321,5 +321,16 @@ namespace GHelper.Gpu
}
}
// Manually forcing standard mode on shutdown/hibernate for some exotic cases
// https://github.com/seerge/g-helper/pull/855
public void StandardModeFix()
{
if (!AppConfig.Is("gpu_fix")) return; // No config entry
if (Program.acpi.DeviceGet(AsusACPI.GPUMux) == 0) return; // Ultimate mode
Logger.WriteLine("Forcing Standard Mode on shutdown / hibernation");
Program.acpi.SetGPUEco(0);
}
}
}

View File

@@ -101,6 +101,10 @@ namespace GHelper
// Subscribing for system power change events
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
clamshellControl.RegisterDisplayEvents();
clamshellControl.ToggleLidAction();
@@ -121,7 +125,19 @@ namespace GHelper
}
private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{
gpuControl.StandardModeFix();
}
private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
{
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
{
Logger.WriteLine("Session:" + e.Reason.ToString());
screenControl.AutoScreen();
}
}
static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
@@ -182,8 +198,12 @@ namespace GHelper
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
Logger.WriteLine("Power Mode:" + e.Mode.ToString());
if (e.Mode == PowerModes.Suspend) gpuControl.StandardModeFix();
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
Logger.WriteLine("Power Mode Changed");
SetAutoModes(true);
}

View File

@@ -199,7 +199,7 @@
<value>唤醒时</value>
</data>
<data name="BacklightTimeout" xml:space="preserve">
<value>插电/电池时背光时间 (0表示长亮)</value>
<value>插电/电池时熄灭时间(0表示长亮</value>
</data>
<data name="Balanced" xml:space="preserve">
<value>平衡模式</value>

View File

@@ -223,6 +223,12 @@ Full list of keycodes https://learn.microsoft.com/en-us/windows/win32/inputdev/v
![Screenshot 2023-07-17 192155](https://github.com/seerge/g-helper/assets/5920850/e450e124-1589-4787-bce8-7c37ffe72fbd)
### Force Standard mode on shutdown / hibernation
In some rare cases G14 2023 seem to have issues with enabling / disabling dGPU - i.e. Eco mode. Till we wait for a fix from asus on BIOS level, one of the proposed solutions is to always shutdown laptop in Standard mode (then everything seem to work fine). To enable "forced" Standard mode on shutdown add following line to ``%AppData%\GHelper\config.json``
```
"gpu_fix" : 1,
```
### Disable OSD
You can disable app's OSD (for performance modes, keyboard backlight, etc) by adding following line to ``%AppData%\GHelper\config.json``
```