Skip to content

Commit

Permalink
Aura brightness check
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Feb 15, 2024
1 parent 60c4e08 commit ebfb9b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/USB/Aura.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public static class Aura
private static AuraMode mode = AuraMode.AuraStatic;
private static AuraSpeed speed = AuraSpeed.Normal;

private static int _brightness = 0;

public static Color Color1 = Color.White;
public static Color Color2 = Color.Black;

Expand Down Expand Up @@ -289,6 +291,8 @@ public static void Init()

public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false)
{
_brightness = brightness;

Task.Run(async () =>
{
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
Expand Down Expand Up @@ -494,6 +498,8 @@ public static void ApplyPower()

public static void ApplyDirect(Color[] color, bool init = false)
{
if (_brightness <= 0) return;

const byte keySet = 167;
const byte ledCount = 178;
const ushort mapSize = 3 * ledCount;
Expand Down Expand Up @@ -574,6 +580,8 @@ public static void ApplyDirect(Color[] color, bool init = false)
public static void ApplyDirect(Color color, bool init = false)
{

if (_brightness <= 0) return;

if (isACPI)
{
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
Expand Down Expand Up @@ -721,6 +729,8 @@ public static void ApplyHeatmap(bool init = false)

public static void ApplyAmbient(bool init = false)
{
if (_brightness <= 0) return;

var bound = Screen.GetBounds(Point.Empty);
bound.Y += bound.Height / 3;
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
Expand Down

0 comments on commit ebfb9b3

Please sign in to comment.