Skip to content

Commit dc80355

Browse files
committed
Aura Battery level mode tweaks #4827
1 parent 9156eaf commit dc80355

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

app/USB/Aura.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static void ApplyBrightness(int brightness, string log = "Backlight", boo
322322
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
323323
DirectBrightness(brightness, log);
324324
if (AppConfig.IsAlly()) ApplyAura();
325-
325+
326326
if (brightness > 0)
327327
{
328328
if (!backlight) initDirect = true;
@@ -666,7 +666,17 @@ public static void ApplyDirect(Color color, bool init = false)
666666

667667
}
668668

669-
public static void ApplyAura(double colorDim = 1)
669+
public static Color ColorDim(Color Color, double colorDim = 1)
670+
{
671+
switch (InputDispatcher.GetBacklight())
672+
{
673+
case 1: colorDim = 0.1; break;
674+
case 2: colorDim = 0.3; break;
675+
}
676+
return Color.FromArgb((int)(Color.R * colorDim), (int)(Color.G * colorDim), (int)(Color.B * colorDim));
677+
}
678+
679+
public static void ApplyAura()
670680
{
671681

672682
Mode = (AuraMode)AppConfig.Get("aura_mode");
@@ -680,17 +690,8 @@ public static void ApplyAura(double colorDim = 1)
680690
// Ally lower brightness fix
681691
if (AppConfig.IsAlly())
682692
{
683-
switch (InputDispatcher.GetBacklight())
684-
{
685-
case 1: colorDim = 0.1; break;
686-
case 2: colorDim = 0.3; break;
687-
}
688-
689-
if (colorDim < 1)
690-
{
691-
_Color1 = Color.FromArgb((int)(Color1.R * colorDim), (int)(Color1.G * colorDim), (int)(Color1.B * colorDim));
692-
_Color2 = Color.FromArgb((int)(Color2.R * colorDim), (int)(Color2.G * colorDim), (int)(Color2.B * colorDim));
693-
}
693+
_Color1 = ColorDim(_Color1);
694+
_Color2 = ColorDim(_Color2);
694695
}
695696

696697
timer.Enabled = false;
@@ -707,7 +708,7 @@ public static void ApplyAura(double colorDim = 1)
707708

708709
if (Mode == AuraMode.BATTERY)
709710
{
710-
CustomRGB.ApplyBattery(true);
711+
CustomRGB.ApplyBattery();
711712
timer.Enabled = true;
712713
timer.Interval = 30000;
713714
return;
@@ -781,7 +782,7 @@ public static class CustomRGB
781782
static int tempWarm = AppConfig.Get("temp_warm", 65);
782783
static int tempHot = AppConfig.Get("temp_hot", 90);
783784

784-
static Color colorFreeze = ColorTranslator.FromHtml(AppConfig.GetString("color_freeze", "#0000FF"));
785+
static Color colorFreeze = ColorTranslator.FromHtml(AppConfig.GetString("color_freeze", "#0000FF"));
785786
static Color colorCold = ColorTranslator.FromHtml(AppConfig.GetString("color_cold", "#008000"));
786787
static Color colorWarm = ColorTranslator.FromHtml(AppConfig.GetString("color_warm", "#FFFF00"));
787788
static Color colorHot = ColorTranslator.FromHtml(AppConfig.GetString("color_hot", "#FF0000"));
@@ -818,7 +819,6 @@ public static void ApplyGPUColor()
818819
}
819820

820821
if (isACPI) Program.acpi.TUFKeyboardRGB(AuraMode.AuraStatic, color, 0xeb);
821-
822822
AsusHid.Write(new List<byte[]> { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_APPLY, MESSAGE_SET });
823823

824824
}
@@ -836,7 +836,7 @@ public static void ApplyHeatmap(bool init = false)
836836
ApplyDirect(color, init);
837837
}
838838

839-
public static void ApplyBattery(bool init = false)
839+
public static void ApplyBattery()
840840
{
841841
float battery = (float)HardwareControl.GetBatteryChargePercentage();
842842
Color color = colorLow;
@@ -862,7 +862,9 @@ public static void ApplyBattery(bool init = false)
862862
color = colorHigh;
863863
}
864864

865-
ApplyDirect(color, init);
865+
if (AppConfig.IsAlly()) color = ColorDim(color);
866+
AsusHid.Write(new List<byte[]> { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_APPLY, MESSAGE_SET });
867+
if (isACPI) Program.acpi.TUFKeyboardRGB(AuraMode.AuraStatic, color, 0xeb);
866868
}
867869

868870
public static void ApplyAmbient(bool init = false)

0 commit comments

Comments
 (0)