Skip to content

Commit

Permalink
Merge pull request #2095 from antonpup/dev
Browse files Browse the repository at this point in the history
v0.8.1
  • Loading branch information
diogotr7 authored Jun 13, 2020
2 parents 7a387ab + ae8091f commit ac69b5a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<TextBlock Text="4. Click the 'Install Plugin' button below and point the dialog to your OsuSync executable. This will copy the required Aurora DLL into the plugins directory." TextWrapping="Wrap" />
<TextBlock TextWrapping="Wrap">
<Run Text="4.1. Alternatively, you can fetch the DLL from the" />
<Hyperlink NavigateUri="https://gitlab.com/wibble199/aurora-gsi-osu/tags" RequestNavigate="Hyperlink_RequestNavigate">Aurora GSI OsuSync plugin GitLab repo</Hyperlink>
<Hyperlink NavigateUri="https://github.com/Aurora-RGB/AuroraGSI-Osu/releases" RequestNavigate="Hyperlink_RequestNavigate">Aurora GSI OsuSync plugin GitLab repo</Hyperlink>
<Run Text="and manually download it into your plugins directory. Note if you do it this way you will need to right-click the saved DLL, choose 'Properties' then click the 'Unblock' button." />
</TextBlock>
<TextBlock Text="5. Finally, restart OsuSync. You should see that when it starts up it says 'Load AuroraGSI'." />
Expand Down
2 changes: 1 addition & 1 deletion Project-Aurora/Project-Aurora/Settings/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public Configuration()
devices_disabled.Add(typeof(Devices.Dualshock.DualshockDevice));
devices_disabled.Add(typeof(Devices.AtmoOrbDevice.AtmoOrbDevice));
devices_disabled.Add(typeof(Devices.NZXT.NZXTDevice));
OverlaysInPreview = false;
OverlaysInPreview = true;

//Blackout and Night theme
time_based_dimming_enabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public override void Default()
this._Coordinates = new Rectangle(0, 0, 0, 0);
this._AmbilightQuality = AmbilightQuality.Medium;
this._BrightenImage = false;
this._BrightnessChange = 0.0f;
this._BrightnessChange = 1.0f;
this._SaturateImage = false;
this._SaturationChange = 1.0f;
this._FlipVertically = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private void stackModeCb_SelectionChanged(object sender, SelectionChangedEventAr

private void btnInfo_Click(object sender, RoutedEventArgs e) {
// Open the online documentation for the Animation Trigger properties
Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/advanced-topics/animation-editor/"));
Process.Start(new ProcessStartInfo(@"https://aurora-rgb.github.io/Docs/advanced-topics/animation-editor/"));
}

private void whileKeyHeldTerminate_Checked(object sender, RoutedEventArgs e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void ForcePropertyListUpdate() {

private void HelpButton_Click(object sender, RoutedEventArgs e) {
// Open the overrides page on the documentation page
Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/advanced-topics/overrides-system/"));
Process.Start(new ProcessStartInfo(@"https://aurora-rgb.github.io/Docs/advanced-topics/overrides-system/"));
}
#endregion
}
Expand Down
89 changes: 48 additions & 41 deletions Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,6 @@ public static bool TryDump()
}
}

private static ISensor FindSensor(this IHardware hardware, string identifier)
{
var result = hardware.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.Identifier.ToString().Contains(identifier));
if (result is null)
{
Global.logger.Error(
$"[HardwareMonitor] Failed to find sensor \"{identifier}\" in {hardware.Name} of type {hardware.HardwareType}.");
}
return result;
}

private static ISensor FindSensor(this IHardware hardware, SensorType type)
{
var result = hardware.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.SensorType == type);
if (result is null)
{
Global.logger.Error(
$"[HardwareMonitor] Failed to find sensor of type \"{type}\" in {hardware.Name} of type {hardware.HardwareType}.");
}
return result;
}

public abstract class HardwareUpdater
{
private const int MAX_QUEUE = 8;
Expand All @@ -105,11 +83,11 @@ public abstract class HardwareUpdater

private readonly Timer _useTimer;
private readonly Timer _updateTimer;
private readonly Queue<float> _values;
private readonly Dictionary<Identifier, Queue<float>> _queues;

protected HardwareUpdater()
{
_values = new Queue<float>(MAX_QUEUE);
_queues = new Dictionary<Identifier, Queue<float>>();
_useTimer = new Timer(5000);
_useTimer.Elapsed += (a, b) =>
{
Expand All @@ -135,14 +113,43 @@ protected float GetValue(ISensor sensor)
_useTimer.Stop();
_useTimer.Start();

if (_values.Count == MAX_QUEUE)
_values.Dequeue();
_values.Enqueue(sensor?.Value ?? 0);
if (!_queues.TryGetValue(sensor.Identifier, out var values))
return 0;

if (values.Count == MAX_QUEUE)
values.Dequeue();
values.Enqueue(sensor?.Value ?? 0);

return Global.Configuration.HardwareMonitorUseAverageValues ?
_values.Average() :
return Global.Configuration.HardwareMonitorUseAverageValues ?
values.Average() :
sensor?.Value ?? 0;
}

protected ISensor FindSensor(string identifier)
{
var result = hw.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.Identifier.ToString().Contains(identifier));
if (result is null)
{
Global.logger.Error(
$"[HardwareMonitor] Failed to find sensor \"{identifier}\" in {hw.Name} of type {hw.HardwareType}.");
return null;
}
_queues.Add(result.Identifier, new Queue<float>(MAX_QUEUE));
return result;
}

protected ISensor FindSensor(SensorType type)
{
var result = hw.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.SensorType == type);
if (result is null)
{
Global.logger.Error(
$"[HardwareMonitor] Failed to find sensor of type \"{type}\" in {hw.Name} of type {hw.HardwareType}.");
return null;
}
_queues.Add(result.Identifier, new Queue<float>(MAX_QUEUE));
return result;
}
}

public sealed class GPUUpdater : HardwareUpdater
Expand Down Expand Up @@ -170,10 +177,10 @@ public GPUUpdater(IEnumerable<IHardware> hardware)
Global.logger.Error("[HardwareMonitor] Could not find hardware of type GPU");
return;
}
_GPULoad = hw.FindSensor(SensorType.Load);
_GPUTemp = hw.FindSensor(SensorType.Temperature);
_GPUFan = hw.FindSensor(SensorType.Fan);
_GPUPower = hw.FindSensor(SensorType.Power);
_GPULoad = FindSensor(SensorType.Load);
_GPUTemp = FindSensor(SensorType.Temperature);
_GPUFan = FindSensor(SensorType.Fan);
_GPUPower = FindSensor(SensorType.Power);
}
}

Expand All @@ -198,9 +205,9 @@ public CPUUpdater(IEnumerable<IHardware> hardware)
Global.logger.Error("[HardwareMonitor] Could not find hardware of type CPU");
return;
}
_CPUTemp = hw.FindSensor(SensorType.Temperature);
_CPULoad = hw.FindSensor(SensorType.Load);
_CPUPower = hw.FindSensor(SensorType.Power);
_CPUTemp = FindSensor(SensorType.Temperature);
_CPULoad = FindSensor(SensorType.Load);
_CPUPower = FindSensor(SensorType.Power);
}
}

Expand All @@ -222,8 +229,8 @@ public RAMUpdater(IEnumerable<IHardware> hws)
Global.logger.Error("[HardwareMonitor] Could not find hardware of type RAM");
return;
}
_RAMUsed = hw.FindSensor("data/0");
_RAMFree = hw.FindSensor("data/1");
_RAMUsed = FindSensor("data/0");
_RAMFree = FindSensor("data/1");
}
}

Expand All @@ -248,9 +255,9 @@ public NETUpdater(IEnumerable<IHardware> hws)
Global.logger.Error("[HardwareMonitor] Could not find hardware of type Network");
return;
}
_BandwidthUsed = hw.FindSensor(SensorType.Load);
_UploadSpeed = hw.FindSensor("throughput/7");
_DownloadSpeed = hw.FindSensor("throughput/8");
_BandwidthUsed = FindSensor(SensorType.Load);
_UploadSpeed = FindSensor("throughput/7");
_DownloadSpeed = FindSensor("throughput/8");
}
}
}
Expand Down

0 comments on commit ac69b5a

Please sign in to comment.