Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Nov 6, 2024
1 parent 5570513 commit f72e3a6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/Ally/AllyControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto, boo
if (init)
{
WakeUp();
InputDispatcher.SetBacklightAuto(true);
InputDispatcher.SetBacklightAuto();
}

AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode], "Controller");
Expand Down
17 changes: 14 additions & 3 deletions app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -873,11 +873,22 @@ public static int GetBacklight()
return Math.Max(Math.Min(3, backlight), 0);
}

public static void SetBacklightAuto(bool init = false)
public static void AutoKeyboard()
{
if (AppConfig.HasTabletMode()) TabletMode();
if (lidClose || AppConfig.Is("skip_aura")) return;

Aura.Init();
Aura.ApplyPower();
Aura.ApplyAura();
SetBacklightAuto();
}


public static void SetBacklightAuto()
{
if (lidClose) return;
if (init) Aura.Init();
Aura.ApplyBrightness(GetBacklight(), "Auto", init);
Aura.ApplyBrightness(GetBacklight(), "Auto");
}

public static void SetBacklight(int delta, bool force = false)
Expand Down
4 changes: 3 additions & 1 deletion app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GHelper.Input;
using GHelper.Mode;
using GHelper.Peripherals;
using GHelper.USB;
using Microsoft.Win32;
using Ryzen;
using System.Diagnostics;
Expand Down Expand Up @@ -258,9 +259,10 @@ public static bool SetAutoModes(bool powerChanged = false, bool init = false)
}
else
{
settingsForm.AutoKeyboard();
InputDispatcher.AutoKeyboard();
}

XGM.InitLight();
VisualControl.InitBrightness();

return true;
Expand Down
18 changes: 0 additions & 18 deletions app/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,24 +1541,6 @@ public void SetModeLabel(string modeText)
}


public void AutoKeyboard()
{

if (!AppConfig.Is("skip_aura"))
{
Aura.ApplyPower();
Aura.ApplyAura();
}

InputDispatcher.SetBacklightAuto(true);

if (Program.acpi.IsXGConnected())
XGM.Light(AppConfig.Is("xmg_light"));

if (AppConfig.HasTabletMode()) InputDispatcher.TabletMode();

}


public void VisualizeXGM(int GPUMode = -1)
{
Expand Down
5 changes: 5 additions & 0 deletions app/USB/Aura.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ private static void ApplyAllyPower(AuraPower flags)
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura");
}

public static void ApplyPowerOff()
{
AsusHid.Write(AuraPowerMessage(new AuraPower()));
}

public static void ApplyPower()
{

Expand Down
4 changes: 4 additions & 0 deletions app/USB/XGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public static void Light(bool status)
Write(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 });
}

public static void InitLight()
{
if (Program.acpi.IsXGConnected()) Light(AppConfig.Is("xmg_light"));
}

public static void Reset()
{
Expand Down

0 comments on commit f72e3a6

Please sign in to comment.