From 4fb49c5e80d5ef651c44830d5a23b9701d7fc907 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 25 Mar 2024 19:07:22 +0300 Subject: [PATCH] Add Humidity Sensors support (#1281) * Add Humidity Sensors support Signed-off-by: wlkmanist * Humidity icon Signed-off-by: wlkmanist * fix humidity icon Signed-off-by: wlkmanist --------- Signed-off-by: wlkmanist --- LibreHardwareMonitor/Resources/humidity.png | Bin 0 -> 853 bytes LibreHardwareMonitor/UI/PlotPanel.cs | 5 +++-- LibreHardwareMonitor/UI/SensorGadget.cs | 5 +++-- LibreHardwareMonitor/UI/SensorNode.cs | 5 ++++- LibreHardwareMonitor/UI/SensorNotifyIcon.cs | 4 +++- LibreHardwareMonitor/UI/TypeNode.cs | 6 +++++- LibreHardwareMonitor/Utilities/HttpServer.cs | 4 +++- LibreHardwareMonitorLib/Hardware/ISensor.cs | 3 ++- 8 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 LibreHardwareMonitor/Resources/humidity.png diff --git a/LibreHardwareMonitor/Resources/humidity.png b/LibreHardwareMonitor/Resources/humidity.png new file mode 100644 index 0000000000000000000000000000000000000000..b6f9e9086cc78c513d71863181daf8469e04b28a GIT binary patch literal 853 zcmV-b1FHOqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA0_sUbK~y+TWs_Y< z6j2n%&%HCV^X=}s?YeDiik6idWMySYMrNUfFA)-j6lhdJB^Z5Z8QBN*AVgne8Aa4f z6w#MP_>vSz6x4%c50!#$sqNOPyRJL4bKAKsE7%W)a}MW!{@i;HgFGG&%w%CjBkJos zN4#qe?Tk#tJ_g@i`jl+_2TsNmp5hbWQWeI`Ed;K!IxaQyg(b(38E5jJLGA)4bU$d+ zE4QDoHV`97ve-hzrBJnP6}U@}Csorhs;VYa07uzL=zDY&7|taWl$Ce%`bU+Rrdw7O zEOXp#-P1Yoy*sI#CUpY2tO){Lr)a*R`pAPxi;W?7 zsxwI$guBktC@-kno9%N|ehozo|Fnl{O{hWk?hCZw zt>xBypZlsK%L@L9D8j0O1kWrK&=GNFxfyBk@-`|Qx<`WvHRylwjTUTf-nBfR8;2$} zqQ!NDF(#1suqO?EL@+E`J+Dei+v20*B>%49Z-e;_E!IS_*_-Wvk-!998Otz$85ShF zgvPiyapz|OTH>iUdl}7l%rN~1!NKtrEM}~#O$IGdV@?7tF=%nhh|81!X9x(*R)BTO z>rMS|%Puoa8)$J()N~A!QyM6CkuVYu7F8mgOC-7%fsx6R5S{`MEnIShk}^=zg&?pJ z41691t4#&bE)z~>0j0B`W1YnKIP^zN18yuiLP;6;Z#2JU=Gq27dozMe?no9MTM?lZTmwyM-7|}?X>U~*_wXOQQ_w|4FXY?gp|aUh>>^`gG5OT zGeeQ_6$4DGseN6$mCjIu(bifp@=rtW;hMVz#kMm!YaJlCc@zPJBG^c5#DZ+YOgM*^ zi=R9`7_;8KPlruXzjMvI4!E^)6V01mcCP!P8@qoYD2(W_FdK#EKD&7N=Em}oCD-nw fPjx#86#~Ft=q~7H^E-1t00000NkvXXu0mjf7@=-_ literal 0 HcmV?d00001 diff --git a/LibreHardwareMonitor/UI/PlotPanel.cs b/LibreHardwareMonitor/UI/PlotPanel.cs index a509df4..c435737 100644 --- a/LibreHardwareMonitor/UI/PlotPanel.cs +++ b/LibreHardwareMonitor/UI/PlotPanel.cs @@ -200,7 +200,8 @@ public class PlotPanel : UserControl { SensorType.Data, "GB" }, { SensorType.Frequency, "Hz" }, { SensorType.Energy, "mWh" }, - { SensorType.Noise, "dBA" } + { SensorType.Noise, "dBA" }, + { SensorType.Humidity, "%" } }; foreach (SensorType type in Enum.GetValues(typeof(SensorType))) @@ -415,4 +416,4 @@ public class PlotPanel : UserControl foreach (LinearAxis axis in _axes.Values) axis.Zoom(double.NaN, double.NaN); } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitor/UI/SensorGadget.cs b/LibreHardwareMonitor/UI/SensorGadget.cs index 7c3b055..84e93c5 100644 --- a/LibreHardwareMonitor/UI/SensorGadget.cs +++ b/LibreHardwareMonitor/UI/SensorGadget.cs @@ -598,7 +598,8 @@ public class SensorGadget : Gadget if ((sensor.SensorType != SensorType.Load && sensor.SensorType != SensorType.Control && - sensor.SensorType != SensorType.Level) || !sensor.Value.HasValue) + sensor.SensorType != SensorType.Level && + sensor.SensorType != SensorType.Humidity) || !sensor.Value.HasValue) { string formatted; @@ -751,4 +752,4 @@ public class SensorGadget : Gadget return x.Identifier.CompareTo(y.Identifier); } } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitor/UI/SensorNode.cs b/LibreHardwareMonitor/UI/SensorNode.cs index d1335fd..505977a 100644 --- a/LibreHardwareMonitor/UI/SensorNode.cs +++ b/LibreHardwareMonitor/UI/SensorNode.cs @@ -82,6 +82,9 @@ public class SensorNode : Node case SensorType.Noise: Format = "{0:F0} dBA"; break; + case SensorType.Humidity: + Format = "{0:F0} %"; + break; } bool hidden = settings.GetValue(new Identifier(sensor.Identifier, "hidden").ToString(), sensor.IsDefaultHidden); @@ -276,4 +279,4 @@ public class SensorNode : Node { return Sensor.GetHashCode(); } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitor/UI/SensorNotifyIcon.cs b/LibreHardwareMonitor/UI/SensorNotifyIcon.cs index d622a76..5987efb 100644 --- a/LibreHardwareMonitor/UI/SensorNotifyIcon.cs +++ b/LibreHardwareMonitor/UI/SensorNotifyIcon.cs @@ -183,6 +183,7 @@ public class SensorNotifyIcon : IDisposable case SensorType.Load: case SensorType.Energy: case SensorType.Noise: + case SensorType.Humidity: return $"{Sensor.Value:F0}"; default: return "-"; @@ -259,6 +260,7 @@ public class SensorNotifyIcon : IDisposable case SensorType.Factor: format = "\n{0}: {1:F3} GB"; break; case SensorType.Energy: format = "\n{0}: {0:F0} mWh"; break; case SensorType.Noise: format = "\n{0}: {0:F0} dBA"; break; + case SensorType.Humidity: format = "\n{0}: {0:F0} %"; break; } string formattedValue = string.Format(format, Sensor.Name, Sensor.Value); @@ -277,4 +279,4 @@ public class SensorNotifyIcon : IDisposable _notifyIcon.Text = text; _notifyIcon.Visible = true; } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitor/UI/TypeNode.cs b/LibreHardwareMonitor/UI/TypeNode.cs index 6162ce7..96d3ea7 100644 --- a/LibreHardwareMonitor/UI/TypeNode.cs +++ b/LibreHardwareMonitor/UI/TypeNode.cs @@ -95,6 +95,10 @@ public sealed class TypeNode : Node, IExpandPersistNode Image = Utilities.EmbeddedResources.GetImage("loudspeaker.png"); Text = "Noise Levels"; break; + case SensorType.Humidity: + Image = Utilities.EmbeddedResources.GetImage("humidity.png"); + Text = "Humidity Levels"; + break; } NodeAdded += TypeNode_NodeAdded; @@ -138,4 +142,4 @@ public sealed class TypeNode : Node, IExpandPersistNode _settings.SetValue(_expandedIdentifier, _expanded); } } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitor/Utilities/HttpServer.cs b/LibreHardwareMonitor/Utilities/HttpServer.cs index 9379ebe..1d7d203 100644 --- a/LibreHardwareMonitor/Utilities/HttpServer.cs +++ b/LibreHardwareMonitor/Utilities/HttpServer.cs @@ -679,6 +679,8 @@ public class HttpServer return "loudspeaker.png"; case SensorType.Throughput: return "throughput.png"; + case SensorType.Humidity: + return "flow.png"; default: return "power.png"; } @@ -703,4 +705,4 @@ public class HttpServer StopHttpListener(); _listener.Abort(); } -} \ No newline at end of file +} diff --git a/LibreHardwareMonitorLib/Hardware/ISensor.cs b/LibreHardwareMonitorLib/Hardware/ISensor.cs index 33b7cd8..802c5db 100644 --- a/LibreHardwareMonitorLib/Hardware/ISensor.cs +++ b/LibreHardwareMonitorLib/Hardware/ISensor.cs @@ -31,7 +31,8 @@ public enum SensorType Throughput, // B/s TimeSpan, // Seconds Energy, // milliwatt-hour (mWh) - Noise // dBA + Noise, // dBA + Humidity // % } ///