Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Nov 13, 2023
1 parent 786bb4e commit 229255f
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions app/USB/Aura.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,6 @@ static Aura()
}
}

private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
SetHeatmap();
}

static void SetHeatmap(bool init = false)
{
float cpuTemp = (float)HardwareControl.GetCPUTemp();
int freeze = 20, cold = 40, warm = 65, hot = 90;
Color color;

//Debug.WriteLine(cpuTemp);

if (cpuTemp < cold) color = ColorUtilities.GetWeightedAverage(Color.Blue, Color.Green, ((float)cpuTemp - freeze) / (cold - freeze));
else if (cpuTemp < warm) color = ColorUtilities.GetWeightedAverage(Color.Green, Color.Yellow, ((float)cpuTemp - cold) / (warm - cold));
else if (cpuTemp < hot) color = ColorUtilities.GetWeightedAverage(Color.Yellow, Color.Red, ((float)cpuTemp - warm) / (hot - warm));
else color = Color.Red;

ApplyColor(color, init);
}

public static Dictionary<AuraSpeed, string> GetSpeeds()
{
return new Dictionary<AuraSpeed, string>
Expand Down Expand Up @@ -218,6 +197,28 @@ public static bool HasSecondColor()
return mode == AuraMode.AuraBreathe && !isACPI;
}

private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
SetHeatmap();
}

static void SetHeatmap(bool init = false)
{
float cpuTemp = (float)HardwareControl.GetCPUTemp();
int freeze = 20, cold = 40, warm = 65, hot = 90;
Color color;

//Debug.WriteLine(cpuTemp);

if (cpuTemp < cold) color = ColorUtilities.GetWeightedAverage(Color.Blue, Color.Green, ((float)cpuTemp - freeze) / (cold - freeze));
else if (cpuTemp < warm) color = ColorUtilities.GetWeightedAverage(Color.Green, Color.Yellow, ((float)cpuTemp - cold) / (warm - cold));
else if (cpuTemp < hot) color = ColorUtilities.GetWeightedAverage(Color.Yellow, Color.Red, ((float)cpuTemp - warm) / (hot - warm));
else color = Color.Red;

ApplyColor(color, init);
}


public static byte[] AuraMessage(AuraMode mode, Color color, Color color2, int speed, bool mono = false)
{

Expand Down

0 comments on commit 229255f

Please sign in to comment.