diff --git a/Project-Aurora/Project-Aurora/Settings/Configuration.cs b/Project-Aurora/Project-Aurora/Settings/Configuration.cs index 5090dffd6..b44d30017 100755 --- a/Project-Aurora/Project-Aurora/Settings/Configuration.cs +++ b/Project-Aurora/Project-Aurora/Settings/Configuration.cs @@ -497,7 +497,8 @@ public class Configuration : INotifyPropertyChanged public float idle_frequency; //Hardware Monitor - public int HardwareMonitorUpdateRate { get; set; } = 300; + public int HardwareMonitorUpdateRate { get; set; } = 500; + public bool HardwareMonitorUseAverageValues { get; set; } = true; public VariableRegistry VarRegistry; diff --git a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml index c954ba8cb..b5de9fc0a 100755 --- a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml +++ b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml @@ -181,6 +181,7 @@ + diff --git a/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs b/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs index 6bb5b2436..1ed0fe2b9 100644 --- a/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs +++ b/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs @@ -57,7 +57,7 @@ public static bool TryDump() lines.Add("-----"); lines.Add(hw.Name); lines.Add("Sensors:"); - foreach (var sensor in hw.Sensors.OrderBy(s => s.SensorType)) + foreach (var sensor in hw.Sensors.OrderBy(s => s.Identifier)) { lines.Add($"Name: {sensor.Name}, Id: {sensor.Identifier}, Type: {sensor.SensorType}"); } @@ -99,14 +99,17 @@ private static ISensor FindSensor(this IHardware hardware, SensorType type) public abstract class HardwareUpdater { + private const int MAX_QUEUE = 8; protected IHardware hw; protected bool inUse; private readonly Timer _useTimer; private readonly Timer _updateTimer; + private readonly Queue _values; protected HardwareUpdater() { + _values = new Queue(MAX_QUEUE); _useTimer = new Timer(5000); _useTimer.Elapsed += (a, b) => { @@ -132,7 +135,13 @@ protected float GetValue(ISensor sensor) _useTimer.Stop(); _useTimer.Start(); - return sensor?.Value ?? 0; + if (_values.Count == MAX_QUEUE) + _values.Dequeue(); + _values.Enqueue(sensor?.Value ?? 0); + + return Global.Configuration.HardwareMonitorUseAverageValues ? + _values.Average() : + sensor?.Value ?? 0; } }