Added a sensor type Control (with unit percent) for (fan) PWM control sensors. Fixed Issue 2.
authormoel.mich
Sat, 15 May 2010 14:16:00 +0000
changeset 118407f98562c3b
parent 117 14329d236f05
child 119 4ca4621553aa
Added a sensor type Control (with unit percent) for (fan) PWM control sensors. Fixed Issue 2.
GUI/HardwareNode.cs
GUI/SensorNode.cs
GUI/SensorNotifyIcon.cs
GUI/TypeNode.cs
Hardware/ISensor.cs
Hardware/TBalancer/TBalancer.cs
OpenHardwareMonitor.csproj
Resources/control.png
     1.1 --- a/GUI/HardwareNode.cs	Sat May 15 12:50:28 2010 +0000
     1.2 +++ b/GUI/HardwareNode.cs	Sat May 15 14:16:00 2010 +0000
     1.3 @@ -58,6 +58,7 @@
     1.4        typeNodes.Add(new TypeNode(SensorType.Load));
     1.5        typeNodes.Add(new TypeNode(SensorType.Fan));
     1.6        typeNodes.Add(new TypeNode(SensorType.Flow));
     1.7 +      typeNodes.Add(new TypeNode(SensorType.Control));
     1.8        
     1.9        foreach (ISensor sensor in hardware.Sensors)
    1.10          SensorAdded(sensor);
     2.1 --- a/GUI/SensorNode.cs	Sat May 15 12:50:28 2010 +0000
     2.2 +++ b/GUI/SensorNode.cs	Sat May 15 14:16:00 2010 +0000
     2.3 @@ -63,6 +63,7 @@
     2.4          case SensorType.Temperature: format = "{0:F1} °C"; break;
     2.5          case SensorType.Fan: format = "{0:F0} RPM"; break;
     2.6          case SensorType.Flow: format = "{0:F0} L/h"; break;
     2.7 +        case SensorType.Control: format = "{0:F1} %"; break;
     2.8        }
     2.9  
    2.10        bool hidden = Config.Get(new Identifier(sensor.Identifier, 
     3.1 --- a/GUI/SensorNotifyIcon.cs	Sat May 15 12:50:28 2010 +0000
     3.2 +++ b/GUI/SensorNotifyIcon.cs	Sat May 15 14:16:00 2010 +0000
     3.3 @@ -151,13 +151,15 @@
     3.4          case SensorType.Clock:
     3.5            return string.Format("{0:F11}", 1e-3f * sensor.Value);
     3.6          case SensorType.Load: 
     3.7 -          return string.Format("{0:F0}", sensor.Value < 99 ? sensor.Value : 99);
     3.8 +          return string.Format("{0:F0}", sensor.Value);
     3.9          case SensorType.Temperature: 
    3.10            return string.Format("{0:F0}", sensor.Value);
    3.11          case SensorType.Fan: 
    3.12            return string.Format("{0:F11}", 1e-3f * sensor.Value);
    3.13          case SensorType.Flow:
    3.14            return string.Format("{0:F11}", 1e-3f * sensor.Value);
    3.15 +        case SensorType.Control:
    3.16 +          return string.Format("{0:F0}", sensor.Value);
    3.17        }
    3.18        return "-";
    3.19      }
    3.20 @@ -235,6 +237,7 @@
    3.21          case SensorType.Temperature: format = "\n{0}: {1:F1} °C"; break;
    3.22          case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break;
    3.23          case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break;
    3.24 +        case SensorType.Control: format = "\n{0}: {1:F1} %"; break;
    3.25        }
    3.26        string formattedValue = string.Format(format, sensor.Name, sensor.Value);
    3.27        string hardwareName = sensor.Hardware.Name;
     4.1 --- a/GUI/TypeNode.cs	Sat May 15 12:50:28 2010 +0000
     4.2 +++ b/GUI/TypeNode.cs	Sat May 15 14:16:00 2010 +0000
     4.3 @@ -72,6 +72,10 @@
     4.4            this.Image = Utilities.EmbeddedResources.GetImage("flow.png");
     4.5            this.Text = "Flows";
     4.6            break;
     4.7 +        case SensorType.Control:
     4.8 +          this.Image = Utilities.EmbeddedResources.GetImage("control.png");
     4.9 +          this.Text = "Controls";
    4.10 +          break;
    4.11        }
    4.12  
    4.13        NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
     5.1 --- a/Hardware/ISensor.cs	Sat May 15 12:50:28 2010 +0000
     5.2 +++ b/Hardware/ISensor.cs	Sat May 15 14:16:00 2010 +0000
     5.3 @@ -47,7 +47,8 @@
     5.4      Temperature,
     5.5      Load,
     5.6      Fan,
     5.7 -    Flow
     5.8 +    Flow,
     5.9 +    Control
    5.10    }
    5.11  
    5.12    public interface ISensorEntry {
     6.1 --- a/Hardware/TBalancer/TBalancer.cs	Sat May 15 12:50:28 2010 +0000
     6.2 +++ b/Hardware/TBalancer/TBalancer.cs	Sat May 15 14:16:00 2010 +0000
     6.3 @@ -53,6 +53,7 @@
     6.4      private Sensor[] sensorhubTemperatures = new Sensor[6];
     6.5      private Sensor[] sensorhubFlows = new Sensor[2];
     6.6      private Sensor[] fans = new Sensor[4];
     6.7 +    private Sensor[] controls = new Sensor[4];
     6.8      private Sensor[] miniNGTemperatures = new Sensor[4];
     6.9      private Sensor[] miniNGFans = new Sensor[4];
    6.10      private List<ISensor> active = new List<ISensor>();
    6.11 @@ -90,20 +91,25 @@
    6.12            offset + i, null, SensorType.Temperature, this, parameter);
    6.13        offset += sensorhubTemperatures.Length;
    6.14  
    6.15 -      for (int i = 0; i < sensorhubFlows.Length; i++)
    6.16 -        sensorhubFlows[i] = new Sensor("Flowmeter " + (i + 1),
    6.17 -          offset + i, null, SensorType.Flow, this, new ParameterDescription[] {
    6.18 -            new ParameterDescription("Impulse Rate", 
    6.19 -              "The impulse rate of the flowmeter in pulses/L", 509)
    6.20 -          });
    6.21 -      offset += sensorhubFlows.Length;
    6.22 -
    6.23        for (int i = 0; i < miniNGTemperatures.Length; i++)
    6.24          miniNGTemperatures[i] = new Sensor("miniNG #" + (i / 2 + 1) +
    6.25            " Sensor " + (i % 2 + 1), offset + i, null, SensorType.Temperature, 
    6.26            this, parameter);
    6.27        offset += miniNGTemperatures.Length;
    6.28  
    6.29 +      for (int i = 0; i < sensorhubFlows.Length; i++)
    6.30 +        sensorhubFlows[i] = new Sensor("Flowmeter " + (i + 1),
    6.31 +          i, null, SensorType.Flow, this, new ParameterDescription[] {
    6.32 +            new ParameterDescription("Impulse Rate", 
    6.33 +              "The impulse rate of the flowmeter in pulses/L", 509)
    6.34 +          });
    6.35 +
    6.36 +      for (int i = 0; i < controls.Length; i++) {
    6.37 +        controls[i] = new Sensor("Fan Channel " + i, i, null, 
    6.38 +          SensorType.Control, this, null);
    6.39 +        ActivateSensor(controls[i]);
    6.40 +      }
    6.41 +
    6.42        alternativeRequest = new MethodDelegate(DelayedAlternativeRequest);
    6.43  
    6.44        Open();
    6.45 @@ -226,11 +232,16 @@
    6.46                    "Maximum revolutions per minute (RPM) of the fan.", maxRPM)
    6.47                });
    6.48  
    6.49 -          if ((data[136] & (1 << i)) == 0) // pwm mode
    6.50 -            fans[i].Value = fans[i].Parameters[0].Value * 0.02f * data[137 + i];
    6.51 +          float value;
    6.52 +          if ((data[136] & (1 << i)) == 0)  // pwm mode
    6.53 +            value = 0.02f * data[137 + i];
    6.54            else // analog mode
    6.55 -            fans[i].Value = fans[i].Parameters[0].Value * 0.01f * data[141 + i]; 
    6.56 +            value = 0.01f * data[141 + i];
    6.57 +          
    6.58 +          fans[i].Value = fans[i].Parameters[0].Value * value;
    6.59            ActivateSensor(fans[i]);
    6.60 +
    6.61 +          controls[i].Value = 100 * value;          
    6.62          }
    6.63  
    6.64        } else if (data[1] == 253) { // miniNG #1
     7.1 --- a/OpenHardwareMonitor.csproj	Sat May 15 12:50:28 2010 +0000
     7.2 +++ b/OpenHardwareMonitor.csproj	Sat May 15 14:16:00 2010 +0000
     7.3 @@ -200,6 +200,9 @@
     7.4      </EmbeddedResource>
     7.5      <EmbeddedResource Include="Resources\mainboard.png" />
     7.6    </ItemGroup>
     7.7 +  <ItemGroup>
     7.8 +    <EmbeddedResource Include="Resources\control.png" />
     7.9 +  </ItemGroup>
    7.10    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    7.11    <ProjectExtensions>
    7.12      <VisualStudio AllowExistingFolder="true" />
     8.1 Binary file Resources/control.png has changed