From fa260097d49a70e1a0d598c1d8e85e119f908334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 15 May 2010 14:16:00 +0000 Subject: [PATCH] Added a sensor type Control (with unit percent) for (fan) PWM control sensors. Fixed Issue 2. --- GUI/HardwareNode.cs | 1 + GUI/SensorNode.cs | 1 + GUI/SensorNotifyIcon.cs | 5 ++++- GUI/TypeNode.cs | 4 ++++ Hardware/ISensor.cs | 3 ++- Hardware/TBalancer/TBalancer.cs | 33 +++++++++++++++++++++----------- OpenHardwareMonitor.csproj | 3 +++ Resources/control.png | Bin 0 -> 814 bytes 8 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 Resources/control.png diff --git a/GUI/HardwareNode.cs b/GUI/HardwareNode.cs index 16572cc..ca93f6a 100644 --- a/GUI/HardwareNode.cs +++ b/GUI/HardwareNode.cs @@ -58,6 +58,7 @@ namespace OpenHardwareMonitor.GUI { typeNodes.Add(new TypeNode(SensorType.Load)); typeNodes.Add(new TypeNode(SensorType.Fan)); typeNodes.Add(new TypeNode(SensorType.Flow)); + typeNodes.Add(new TypeNode(SensorType.Control)); foreach (ISensor sensor in hardware.Sensors) SensorAdded(sensor); diff --git a/GUI/SensorNode.cs b/GUI/SensorNode.cs index d4e8976..8ecc7a8 100644 --- a/GUI/SensorNode.cs +++ b/GUI/SensorNode.cs @@ -63,6 +63,7 @@ namespace OpenHardwareMonitor.GUI { case SensorType.Temperature: format = "{0:F1} °C"; break; case SensorType.Fan: format = "{0:F0} RPM"; break; case SensorType.Flow: format = "{0:F0} L/h"; break; + case SensorType.Control: format = "{0:F1} %"; break; } bool hidden = Config.Get(new Identifier(sensor.Identifier, diff --git a/GUI/SensorNotifyIcon.cs b/GUI/SensorNotifyIcon.cs index 8bc5cdf..1d90978 100644 --- a/GUI/SensorNotifyIcon.cs +++ b/GUI/SensorNotifyIcon.cs @@ -151,13 +151,15 @@ namespace OpenHardwareMonitor.GUI { case SensorType.Clock: return string.Format("{0:F11}", 1e-3f * sensor.Value); case SensorType.Load: - return string.Format("{0:F0}", sensor.Value < 99 ? sensor.Value : 99); + return string.Format("{0:F0}", sensor.Value); case SensorType.Temperature: return string.Format("{0:F0}", sensor.Value); case SensorType.Fan: return string.Format("{0:F11}", 1e-3f * sensor.Value); case SensorType.Flow: return string.Format("{0:F11}", 1e-3f * sensor.Value); + case SensorType.Control: + return string.Format("{0:F0}", sensor.Value); } return "-"; } @@ -235,6 +237,7 @@ namespace OpenHardwareMonitor.GUI { case SensorType.Temperature: format = "\n{0}: {1:F1} °C"; break; case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break; case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break; + case SensorType.Control: format = "\n{0}: {1:F1} %"; break; } string formattedValue = string.Format(format, sensor.Name, sensor.Value); string hardwareName = sensor.Hardware.Name; diff --git a/GUI/TypeNode.cs b/GUI/TypeNode.cs index 08fe496..eabd722 100644 --- a/GUI/TypeNode.cs +++ b/GUI/TypeNode.cs @@ -72,6 +72,10 @@ namespace OpenHardwareMonitor.GUI { this.Image = Utilities.EmbeddedResources.GetImage("flow.png"); this.Text = "Flows"; break; + case SensorType.Control: + this.Image = Utilities.EmbeddedResources.GetImage("control.png"); + this.Text = "Controls"; + break; } NodeAdded += new NodeEventHandler(TypeNode_NodeAdded); diff --git a/Hardware/ISensor.cs b/Hardware/ISensor.cs index 672a121..67be541 100644 --- a/Hardware/ISensor.cs +++ b/Hardware/ISensor.cs @@ -47,7 +47,8 @@ namespace OpenHardwareMonitor.Hardware { Temperature, Load, Fan, - Flow + Flow, + Control } public interface ISensorEntry { diff --git a/Hardware/TBalancer/TBalancer.cs b/Hardware/TBalancer/TBalancer.cs index 283c987..2dbfdd8 100644 --- a/Hardware/TBalancer/TBalancer.cs +++ b/Hardware/TBalancer/TBalancer.cs @@ -53,6 +53,7 @@ namespace OpenHardwareMonitor.Hardware.TBalancer { private Sensor[] sensorhubTemperatures = new Sensor[6]; private Sensor[] sensorhubFlows = new Sensor[2]; private Sensor[] fans = new Sensor[4]; + private Sensor[] controls = new Sensor[4]; private Sensor[] miniNGTemperatures = new Sensor[4]; private Sensor[] miniNGFans = new Sensor[4]; private List active = new List(); @@ -90,20 +91,25 @@ namespace OpenHardwareMonitor.Hardware.TBalancer { offset + i, null, SensorType.Temperature, this, parameter); offset += sensorhubTemperatures.Length; - for (int i = 0; i < sensorhubFlows.Length; i++) - sensorhubFlows[i] = new Sensor("Flowmeter " + (i + 1), - offset + i, null, SensorType.Flow, this, new ParameterDescription[] { - new ParameterDescription("Impulse Rate", - "The impulse rate of the flowmeter in pulses/L", 509) - }); - offset += sensorhubFlows.Length; - for (int i = 0; i < miniNGTemperatures.Length; i++) miniNGTemperatures[i] = new Sensor("miniNG #" + (i / 2 + 1) + " Sensor " + (i % 2 + 1), offset + i, null, SensorType.Temperature, this, parameter); offset += miniNGTemperatures.Length; + for (int i = 0; i < sensorhubFlows.Length; i++) + sensorhubFlows[i] = new Sensor("Flowmeter " + (i + 1), + i, null, SensorType.Flow, this, new ParameterDescription[] { + new ParameterDescription("Impulse Rate", + "The impulse rate of the flowmeter in pulses/L", 509) + }); + + for (int i = 0; i < controls.Length; i++) { + controls[i] = new Sensor("Fan Channel " + i, i, null, + SensorType.Control, this, null); + ActivateSensor(controls[i]); + } + alternativeRequest = new MethodDelegate(DelayedAlternativeRequest); Open(); @@ -226,11 +232,16 @@ namespace OpenHardwareMonitor.Hardware.TBalancer { "Maximum revolutions per minute (RPM) of the fan.", maxRPM) }); - if ((data[136] & (1 << i)) == 0) // pwm mode - fans[i].Value = fans[i].Parameters[0].Value * 0.02f * data[137 + i]; + float value; + if ((data[136] & (1 << i)) == 0) // pwm mode + value = 0.02f * data[137 + i]; else // analog mode - fans[i].Value = fans[i].Parameters[0].Value * 0.01f * data[141 + i]; + value = 0.01f * data[141 + i]; + + fans[i].Value = fans[i].Parameters[0].Value * value; ActivateSensor(fans[i]); + + controls[i].Value = 100 * value; } } else if (data[1] == 253) { // miniNG #1 diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index 8dcf543..22ec9e5 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -200,6 +200,9 @@ + + + diff --git a/Resources/control.png b/Resources/control.png new file mode 100644 index 0000000000000000000000000000000000000000..52f6212db337dda326eb7f45bf3939078c6b5c7f GIT binary patch literal 814 zcmV+}1JV46P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igS> z4IK?;_lZ3K000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0007sNklMWM{0Tu`%IaMlZ$3hW500b!T11L-nF<4My$pzZV z6%`E`xdGyGacnEdvSbN7v$CAowdZ~wicu^D18;S7b@kl$-1i*#hmMYp_%E%muU|XM zpBIORhb%5G((m^d%BuSO_tEIRaaG-{>l*9aCvsUvwm!@ex8xDtG0m$a&_q?*O@an<-!Jof9eyrVYM~q}3 zt-Tl%F$RJUxZrTsYp0V-RgGVZA^ar(TU%S-Zf|dYAR=U0hB2nKB}$6gLV_p6Nbmtg znNFwQ?dzZ@87TMnr^p?F$N=TXDXmci7BBm;$t9&i1Q9jdLL*3r{(F4cb=3I z#ux-a3}^x+k&=>9B*sJtEu@~*GgmQACsVQ3k_CgR((Cm(ub+__LsCU!B&w2PB&9@3 z5$Bv-0b-2D*4bN`$>i?W#!%qdwY8nMS;mO zcTg|JS>J148kT1V(@Y82|tP07*qoM6N<$g6Mo