# HG changeset patch # User moel.mich # Date 1273932960 0 # Node ID 407f98562c3b1b0b02925c16cd085fe292bd2e12 # Parent 14329d236f056f4287e5107ac80bd0adc377b129 Added a sensor type Control (with unit percent) for (fan) PWM control sensors. Fixed Issue 2. diff -r 14329d236f05 -r 407f98562c3b GUI/HardwareNode.cs --- a/GUI/HardwareNode.cs Sat May 15 12:50:28 2010 +0000 +++ b/GUI/HardwareNode.cs Sat May 15 14:16:00 2010 +0000 @@ -58,6 +58,7 @@ 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 -r 14329d236f05 -r 407f98562c3b GUI/SensorNode.cs --- a/GUI/SensorNode.cs Sat May 15 12:50:28 2010 +0000 +++ b/GUI/SensorNode.cs Sat May 15 14:16:00 2010 +0000 @@ -63,6 +63,7 @@ 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 -r 14329d236f05 -r 407f98562c3b GUI/SensorNotifyIcon.cs --- a/GUI/SensorNotifyIcon.cs Sat May 15 12:50:28 2010 +0000 +++ b/GUI/SensorNotifyIcon.cs Sat May 15 14:16:00 2010 +0000 @@ -151,13 +151,15 @@ 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 @@ 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 -r 14329d236f05 -r 407f98562c3b GUI/TypeNode.cs --- a/GUI/TypeNode.cs Sat May 15 12:50:28 2010 +0000 +++ b/GUI/TypeNode.cs Sat May 15 14:16:00 2010 +0000 @@ -72,6 +72,10 @@ 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 -r 14329d236f05 -r 407f98562c3b Hardware/ISensor.cs --- a/Hardware/ISensor.cs Sat May 15 12:50:28 2010 +0000 +++ b/Hardware/ISensor.cs Sat May 15 14:16:00 2010 +0000 @@ -47,7 +47,8 @@ Temperature, Load, Fan, - Flow + Flow, + Control } public interface ISensorEntry { diff -r 14329d236f05 -r 407f98562c3b Hardware/TBalancer/TBalancer.cs --- a/Hardware/TBalancer/TBalancer.cs Sat May 15 12:50:28 2010 +0000 +++ b/Hardware/TBalancer/TBalancer.cs Sat May 15 14:16:00 2010 +0000 @@ -53,6 +53,7 @@ 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 @@ 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 @@ "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 -r 14329d236f05 -r 407f98562c3b OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Sat May 15 12:50:28 2010 +0000 +++ b/OpenHardwareMonitor.csproj Sat May 15 14:16:00 2010 +0000 @@ -200,6 +200,9 @@ + + + diff -r 14329d236f05 -r 407f98562c3b Resources/control.png Binary file Resources/control.png has changed