Added a new sensor type "Factor" for dimensionless values (and similar) that are not to be shown as percent ("Level" type). Changed the write amplification sensor to use the new "Factor" sensor type. Added the temperature SMART attribute for Sandforce SSDs as hidden sensor (as it may show fake results on some hardware).
authormoel.mich
Tue, 14 Feb 2012 23:07:55 +0000
changeset 340600962f8a298
parent 339 07a6126a4796
child 341 5172a92c5c20
Added a new sensor type "Factor" for dimensionless values (and similar) that are not to be shown as percent ("Level" type). Changed the write amplification sensor to use the new "Factor" sensor type. Added the temperature SMART attribute for Sandforce SSDs as hidden sensor (as it may show fake results on some hardware).
GUI/HardwareNode.cs
GUI/SensorGadget.cs
GUI/SensorNode.cs
GUI/SensorNotifyIcon.cs
GUI/TypeNode.cs
Hardware/HDD/AbstractHarddrive.cs
Hardware/HDD/SSDSandforce.cs
Hardware/HDD/SmartAttribute.cs
Hardware/ISensor.cs
OpenHardwareMonitor.csproj
Properties/AssemblyVersion.cs
Resources/factor.png
     1.1 --- a/GUI/HardwareNode.cs	Mon Feb 13 21:56:29 2012 +0000
     1.2 +++ b/GUI/HardwareNode.cs	Tue Feb 14 23:07:55 2012 +0000
     1.3 @@ -16,7 +16,7 @@
     1.4  
     1.5    The Initial Developer of the Original Code is 
     1.6    Michael Möller <m.moeller@gmx.ch>.
     1.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2011
     1.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2012
     1.9    the Initial Developer. All Rights Reserved.
    1.10  
    1.11    Contributor(s):
    1.12 @@ -57,16 +57,8 @@
    1.13        this.hardware = hardware;
    1.14        this.Image = HardwareTypeImage.Instance.GetImage(hardware.HardwareType);
    1.15  
    1.16 -      typeNodes.Add(new TypeNode(SensorType.Voltage));
    1.17 -      typeNodes.Add(new TypeNode(SensorType.Clock));      
    1.18 -      typeNodes.Add(new TypeNode(SensorType.Temperature));
    1.19 -      typeNodes.Add(new TypeNode(SensorType.Load));
    1.20 -      typeNodes.Add(new TypeNode(SensorType.Fan));
    1.21 -      typeNodes.Add(new TypeNode(SensorType.Flow));
    1.22 -      typeNodes.Add(new TypeNode(SensorType.Control));
    1.23 -      typeNodes.Add(new TypeNode(SensorType.Level));
    1.24 -      typeNodes.Add(new TypeNode(SensorType.Power));
    1.25 -      typeNodes.Add(new TypeNode(SensorType.Data));
    1.26 +      foreach (SensorType sensorType in Enum.GetValues(typeof(SensorType)))
    1.27 +        typeNodes.Add(new TypeNode(sensorType));
    1.28  
    1.29        foreach (ISensor sensor in hardware.Sensors)
    1.30          SensorAdded(sensor);
     2.1 --- a/GUI/SensorGadget.cs	Mon Feb 13 21:56:29 2012 +0000
     2.2 +++ b/GUI/SensorGadget.cs	Tue Feb 14 23:07:55 2012 +0000
     2.3 @@ -16,7 +16,7 @@
     2.4  
     2.5    The Initial Developer of the Original Code is 
     2.6    Michael Möller <m.moeller@gmx.ch>.
     2.7 -  Portions created by the Initial Developer are Copyright (C) 2010-2011
     2.8 +  Portions created by the Initial Developer are Copyright (C) 2010-2012
     2.9    the Initial Developer. All Rights Reserved.
    2.10  
    2.11    Contributor(s):
    2.12 @@ -521,6 +521,9 @@
    2.13                  case SensorType.Data:
    2.14                    format = "{0:F1} GB";
    2.15                    break;
    2.16 +                case SensorType.Factor:
    2.17 +                  format = "{0:F3}";
    2.18 +                  break;
    2.19                }
    2.20  
    2.21                if (sensor.SensorType == SensorType.Temperature &&
     3.1 --- a/GUI/SensorNode.cs	Mon Feb 13 21:56:29 2012 +0000
     3.2 +++ b/GUI/SensorNode.cs	Tue Feb 14 23:07:55 2012 +0000
     3.3 @@ -16,7 +16,7 @@
     3.4  
     3.5    The Initial Developer of the Original Code is 
     3.6    Michael Möller <m.moeller@gmx.ch>.
     3.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2011
     3.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2012
     3.9    the Initial Developer. All Rights Reserved.
    3.10  
    3.11    Contributor(s):
    3.12 @@ -77,6 +77,7 @@
    3.13          case SensorType.Level: format = "{0:F1} %"; break;
    3.14          case SensorType.Power: format = "{0:F1} W"; break;
    3.15          case SensorType.Data: format = "{0:F1} GB"; break;
    3.16 +        case SensorType.Factor: format = "{0:F3}"; break;
    3.17        }
    3.18  
    3.19        bool hidden = settings.GetValue(new Identifier(sensor.Identifier, 
     4.1 --- a/GUI/SensorNotifyIcon.cs	Mon Feb 13 21:56:29 2012 +0000
     4.2 +++ b/GUI/SensorNotifyIcon.cs	Tue Feb 14 23:07:55 2012 +0000
     4.3 @@ -16,7 +16,7 @@
     4.4  
     4.5    The Initial Developer of the Original Code is 
     4.6    Michael Möller <m.moeller@gmx.ch>.
     4.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2011
     4.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2012
     4.9    the Initial Developer. All Rights Reserved.
    4.10  
    4.11    Contributor(s):
    4.12 @@ -181,17 +181,17 @@
    4.13  
    4.14        switch (sensor.SensorType) {
    4.15          case SensorType.Voltage:
    4.16 -          return string.Format("{0:F11}", sensor.Value);
    4.17 +          return string.Format("{0:F1}", sensor.Value);
    4.18          case SensorType.Clock:
    4.19 -          return string.Format("{0:F11}", 1e-3f * sensor.Value);
    4.20 +          return string.Format("{0:F1}", 1e-3f * sensor.Value);
    4.21          case SensorType.Load: 
    4.22            return string.Format("{0:F0}", sensor.Value);
    4.23          case SensorType.Temperature: 
    4.24            return string.Format("{0:F0}", sensor.Value);
    4.25          case SensorType.Fan: 
    4.26 -          return string.Format("{0:F11}", 1e-3f * sensor.Value);
    4.27 +          return string.Format("{0:F1}", 1e-3f * sensor.Value);
    4.28          case SensorType.Flow:
    4.29 -          return string.Format("{0:F11}", 1e-3f * sensor.Value);
    4.30 +          return string.Format("{0:F1}", 1e-3f * sensor.Value);
    4.31          case SensorType.Control:
    4.32            return string.Format("{0:F0}", sensor.Value);
    4.33          case SensorType.Level:
    4.34 @@ -200,6 +200,8 @@
    4.35            return string.Format("{0:F0}", sensor.Value);
    4.36          case SensorType.Data:
    4.37            return string.Format("{0:F0}", sensor.Value);
    4.38 +        case SensorType.Factor:
    4.39 +          return string.Format("{0:F1}", sensor.Value);
    4.40        }
    4.41        return "-";
    4.42      }
    4.43 @@ -289,6 +291,7 @@
    4.44          case SensorType.Level: format = "\n{0}: {1:F1} %"; break;
    4.45          case SensorType.Power: format = "\n{0}: {1:F0} W"; break;
    4.46          case SensorType.Data: format = "\n{0}: {1:F0} GB"; break;
    4.47 +        case SensorType.Factor: format = "\n{0}: {1:F3} GB"; break;
    4.48        }
    4.49        string formattedValue = string.Format(format, sensor.Name, sensor.Value);
    4.50        string hardwareName = sensor.Hardware.Name;
     5.1 --- a/GUI/TypeNode.cs	Mon Feb 13 21:56:29 2012 +0000
     5.2 +++ b/GUI/TypeNode.cs	Tue Feb 14 23:07:55 2012 +0000
     5.3 @@ -16,7 +16,7 @@
     5.4  
     5.5    The Initial Developer of the Original Code is 
     5.6    Michael Möller <m.moeller@gmx.ch>.
     5.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2011
     5.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2012
     5.9    the Initial Developer. All Rights Reserved.
    5.10  
    5.11    Contributor(s):
    5.12 @@ -88,6 +88,10 @@
    5.13            this.Image = Utilities.EmbeddedResources.GetImage("data.png");
    5.14            this.Text = "Data";
    5.15            break;
    5.16 +        case SensorType.Factor:
    5.17 +          this.Image = Utilities.EmbeddedResources.GetImage("factor.png");
    5.18 +          this.Text = "Factors";
    5.19 +          break;
    5.20        }
    5.21  
    5.22        NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
     6.1 --- a/Hardware/HDD/AbstractHarddrive.cs	Mon Feb 13 21:56:29 2012 +0000
     6.2 +++ b/Hardware/HDD/AbstractHarddrive.cs	Tue Feb 14 23:07:55 2012 +0000
     6.3 @@ -179,8 +179,8 @@
     6.4  
     6.5          if (!sensorTypeAndChannels.Contains(pair)) {
     6.6            Sensor sensor = new Sensor(attribute.Name, 
     6.7 -            attribute.SensorChannel, attribute.SensorType.Value, this, 
     6.8 -            settings);
     6.9 +            attribute.SensorChannel, attribute.DefaultHiddenSensor, 
    6.10 +            attribute.SensorType.Value, this, null, settings);
    6.11  
    6.12            sensors.Add(attribute, sensor);
    6.13            ActivateSensor(sensor);
     7.1 --- a/Hardware/HDD/SSDSandforce.cs	Mon Feb 13 21:56:29 2012 +0000
     7.2 +++ b/Hardware/HDD/SSDSandforce.cs	Tue Feb 14 23:07:55 2012 +0000
     7.3 @@ -55,8 +55,8 @@
     7.4        new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
     7.5        new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
     7.6        new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
     7.7 -      new SmartAttribute(0xC2, SmartNames.Temperature, 
     7.8 -        (byte[] raw, byte value) => { return value; }), 
     7.9 +      new SmartAttribute(0xC2, SmartNames.Temperature, (byte[] raw, byte value) 
    7.10 +        => { return value; }, SensorType.Temperature, 0, true), 
    7.11        new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc), 
    7.12        new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
    7.13        new SmartAttribute(0xE7, SmartNames.RemainingLife, null, 
    7.14 @@ -78,7 +78,7 @@
    7.15        : base(smart, name, firmwareRevision,  index, smartAttributes, settings) 
    7.16      {
    7.17        this.writeAmplification = new Sensor("Write Amplification", 1, 
    7.18 -        SensorType.Level, this, settings);    
    7.19 +        SensorType.Factor, this, settings);    
    7.20      }
    7.21  
    7.22      public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
    7.23 @@ -92,7 +92,7 @@
    7.24            hostWritesToController = RawToInt(value.RawValue, value.AttrValue);
    7.25        }
    7.26        if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
    7.27 -        writeAmplification.Value = 100 *
    7.28 +        writeAmplification.Value = 
    7.29            controllerWritesToNAND.Value / hostWritesToController.Value;
    7.30          ActivateSensor(writeAmplification);
    7.31        }
     8.1 --- a/Hardware/HDD/SmartAttribute.cs	Mon Feb 13 21:56:29 2012 +0000
     8.2 +++ b/Hardware/HDD/SmartAttribute.cs	Tue Feb 14 23:07:55 2012 +0000
     8.3 @@ -16,7 +16,7 @@
     8.4  
     8.5    The Initial Developer of the Original Code is 
     8.6    Michael Möller <m.moeller@gmx.ch>.
     8.7 -  Portions created by the Initial Developer are Copyright (C) 2011
     8.8 +  Portions created by the Initial Developer are Copyright (C) 2011-2012
     8.9    the Initial Developer. All Rights Reserved.
    8.10  
    8.11    Contributor(s):
    8.12 @@ -75,15 +75,17 @@
    8.13      /// <param name="sensorChannel">If there exists more than one attribute with 
    8.14      /// the same sensor channel and type, then a sensor is created only for the  
    8.15      /// first attribute.</param>
    8.16 +    /// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
    8.17      public SmartAttribute(byte identifier, string name,
    8.18        RawValueConversion rawValueConversion, SensorType? sensorType, 
    8.19 -      int sensorChannel) 
    8.20 +      int sensorChannel, bool defaultHiddenSensor = false) 
    8.21      {
    8.22        this.Identifier = identifier;
    8.23        this.Name = name;
    8.24        this.rawValueConversion = rawValueConversion;
    8.25        this.SensorType = sensorType;
    8.26        this.SensorChannel = sensorChannel;
    8.27 +      this.DefaultHiddenSensor = defaultHiddenSensor;
    8.28      }
    8.29  
    8.30      /// <summary>
    8.31 @@ -97,6 +99,8 @@
    8.32  
    8.33      public int SensorChannel { get; private set; }
    8.34  
    8.35 +    public bool DefaultHiddenSensor { get; private set; }
    8.36 +
    8.37      public bool HasRawValueConversion {
    8.38        get {
    8.39          return rawValueConversion != null;
     9.1 --- a/Hardware/ISensor.cs	Mon Feb 13 21:56:29 2012 +0000
     9.2 +++ b/Hardware/ISensor.cs	Tue Feb 14 23:07:55 2012 +0000
     9.3 @@ -16,7 +16,7 @@
     9.4  
     9.5    The Initial Developer of the Original Code is 
     9.6    Michael Möller <m.moeller@gmx.ch>.
     9.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2011
     9.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2012
     9.9    the Initial Developer. All Rights Reserved.
    9.10  
    9.11    Contributor(s):
    9.12 @@ -50,8 +50,9 @@
    9.13      Flow, // L/h
    9.14      Control, // %
    9.15      Level, // %
    9.16 +    Factor, // 1
    9.17      Power, // W
    9.18 -    Data, // GB = 2^30 Bytes
    9.19 +    Data, // GB = 2^30 Bytes    
    9.20    }
    9.21  
    9.22    public struct SensorValue {
    10.1 --- a/OpenHardwareMonitor.csproj	Mon Feb 13 21:56:29 2012 +0000
    10.2 +++ b/OpenHardwareMonitor.csproj	Tue Feb 14 23:07:55 2012 +0000
    10.3 @@ -225,6 +225,9 @@
    10.4    <ItemGroup>
    10.5      <EmbeddedResource Include="Resources\data.png" />
    10.6    </ItemGroup>
    10.7 +  <ItemGroup>
    10.8 +    <EmbeddedResource Include="Resources\factor.png" />
    10.9 +  </ItemGroup>
   10.10    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   10.11    <ProjectExtensions>
   10.12      <VisualStudio AllowExistingFolder="true" />
    11.1 --- a/Properties/AssemblyVersion.cs	Mon Feb 13 21:56:29 2012 +0000
    11.2 +++ b/Properties/AssemblyVersion.cs	Tue Feb 14 23:07:55 2012 +0000
    11.3 @@ -37,5 +37,5 @@
    11.4  
    11.5  using System.Reflection;
    11.6  
    11.7 -[assembly: AssemblyVersion("0.4.0.2")]
    11.8 -[assembly: AssemblyInformationalVersion("0.4.0.2 Alpha")]
    11.9 \ No newline at end of file
   11.10 +[assembly: AssemblyVersion("0.4.0.3")]
   11.11 +[assembly: AssemblyInformationalVersion("0.4.0.3 Alpha")]
   11.12 \ No newline at end of file
    12.1 Binary file Resources/factor.png has changed