# HG changeset patch # User moel.mich # Date 1329260875 0 # Node ID 600962f8a2980693b00c0cdf0bcd86cd110a7687 # Parent 07a6126a47965adee976db73803dd95afb160c5b 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). diff -r 07a6126a4796 -r 600962f8a298 GUI/HardwareNode.cs --- a/GUI/HardwareNode.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/GUI/HardwareNode.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2011 + Portions created by the Initial Developer are Copyright (C) 2009-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -57,16 +57,8 @@ this.hardware = hardware; this.Image = HardwareTypeImage.Instance.GetImage(hardware.HardwareType); - typeNodes.Add(new TypeNode(SensorType.Voltage)); - typeNodes.Add(new TypeNode(SensorType.Clock)); - typeNodes.Add(new TypeNode(SensorType.Temperature)); - typeNodes.Add(new TypeNode(SensorType.Load)); - typeNodes.Add(new TypeNode(SensorType.Fan)); - typeNodes.Add(new TypeNode(SensorType.Flow)); - typeNodes.Add(new TypeNode(SensorType.Control)); - typeNodes.Add(new TypeNode(SensorType.Level)); - typeNodes.Add(new TypeNode(SensorType.Power)); - typeNodes.Add(new TypeNode(SensorType.Data)); + foreach (SensorType sensorType in Enum.GetValues(typeof(SensorType))) + typeNodes.Add(new TypeNode(sensorType)); foreach (ISensor sensor in hardware.Sensors) SensorAdded(sensor); diff -r 07a6126a4796 -r 600962f8a298 GUI/SensorGadget.cs --- a/GUI/SensorGadget.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/GUI/SensorGadget.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2010-2011 + Portions created by the Initial Developer are Copyright (C) 2010-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -521,6 +521,9 @@ case SensorType.Data: format = "{0:F1} GB"; break; + case SensorType.Factor: + format = "{0:F3}"; + break; } if (sensor.SensorType == SensorType.Temperature && diff -r 07a6126a4796 -r 600962f8a298 GUI/SensorNode.cs --- a/GUI/SensorNode.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/GUI/SensorNode.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2011 + Portions created by the Initial Developer are Copyright (C) 2009-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -77,6 +77,7 @@ case SensorType.Level: format = "{0:F1} %"; break; case SensorType.Power: format = "{0:F1} W"; break; case SensorType.Data: format = "{0:F1} GB"; break; + case SensorType.Factor: format = "{0:F3}"; break; } bool hidden = settings.GetValue(new Identifier(sensor.Identifier, diff -r 07a6126a4796 -r 600962f8a298 GUI/SensorNotifyIcon.cs --- a/GUI/SensorNotifyIcon.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/GUI/SensorNotifyIcon.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2011 + Portions created by the Initial Developer are Copyright (C) 2009-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -181,17 +181,17 @@ switch (sensor.SensorType) { case SensorType.Voltage: - return string.Format("{0:F11}", sensor.Value); + return string.Format("{0:F1}", sensor.Value); case SensorType.Clock: - return string.Format("{0:F11}", 1e-3f * sensor.Value); + return string.Format("{0:F1}", 1e-3f * sensor.Value); case SensorType.Load: 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); + return string.Format("{0:F1}", 1e-3f * sensor.Value); case SensorType.Flow: - return string.Format("{0:F11}", 1e-3f * sensor.Value); + return string.Format("{0:F1}", 1e-3f * sensor.Value); case SensorType.Control: return string.Format("{0:F0}", sensor.Value); case SensorType.Level: @@ -200,6 +200,8 @@ return string.Format("{0:F0}", sensor.Value); case SensorType.Data: return string.Format("{0:F0}", sensor.Value); + case SensorType.Factor: + return string.Format("{0:F1}", sensor.Value); } return "-"; } @@ -289,6 +291,7 @@ case SensorType.Level: format = "\n{0}: {1:F1} %"; break; case SensorType.Power: format = "\n{0}: {1:F0} W"; break; case SensorType.Data: format = "\n{0}: {1:F0} GB"; break; + case SensorType.Factor: format = "\n{0}: {1:F3} GB"; break; } string formattedValue = string.Format(format, sensor.Name, sensor.Value); string hardwareName = sensor.Hardware.Name; diff -r 07a6126a4796 -r 600962f8a298 GUI/TypeNode.cs --- a/GUI/TypeNode.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/GUI/TypeNode.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2011 + Portions created by the Initial Developer are Copyright (C) 2009-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -88,6 +88,10 @@ this.Image = Utilities.EmbeddedResources.GetImage("data.png"); this.Text = "Data"; break; + case SensorType.Factor: + this.Image = Utilities.EmbeddedResources.GetImage("factor.png"); + this.Text = "Factors"; + break; } NodeAdded += new NodeEventHandler(TypeNode_NodeAdded); diff -r 07a6126a4796 -r 600962f8a298 Hardware/HDD/AbstractHarddrive.cs --- a/Hardware/HDD/AbstractHarddrive.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/Hardware/HDD/AbstractHarddrive.cs Tue Feb 14 23:07:55 2012 +0000 @@ -179,8 +179,8 @@ if (!sensorTypeAndChannels.Contains(pair)) { Sensor sensor = new Sensor(attribute.Name, - attribute.SensorChannel, attribute.SensorType.Value, this, - settings); + attribute.SensorChannel, attribute.DefaultHiddenSensor, + attribute.SensorType.Value, this, null, settings); sensors.Add(attribute, sensor); ActivateSensor(sensor); diff -r 07a6126a4796 -r 600962f8a298 Hardware/HDD/SSDSandforce.cs --- a/Hardware/HDD/SSDSandforce.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/Hardware/HDD/SSDSandforce.cs Tue Feb 14 23:07:55 2012 +0000 @@ -55,8 +55,8 @@ new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt), new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt), new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt), - new SmartAttribute(0xC2, SmartNames.Temperature, - (byte[] raw, byte value) => { return value; }), + new SmartAttribute(0xC2, SmartNames.Temperature, (byte[] raw, byte value) + => { return value; }, SensorType.Temperature, 0, true), new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc), new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt), new SmartAttribute(0xE7, SmartNames.RemainingLife, null, @@ -78,7 +78,7 @@ : base(smart, name, firmwareRevision, index, smartAttributes, settings) { this.writeAmplification = new Sensor("Write Amplification", 1, - SensorType.Level, this, settings); + SensorType.Factor, this, settings); } public override void UpdateAdditionalSensors(DriveAttributeValue[] values) { @@ -92,7 +92,7 @@ hostWritesToController = RawToInt(value.RawValue, value.AttrValue); } if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) { - writeAmplification.Value = 100 * + writeAmplification.Value = controllerWritesToNAND.Value / hostWritesToController.Value; ActivateSensor(writeAmplification); } diff -r 07a6126a4796 -r 600962f8a298 Hardware/HDD/SmartAttribute.cs --- a/Hardware/HDD/SmartAttribute.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/Hardware/HDD/SmartAttribute.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2011 + Portions created by the Initial Developer are Copyright (C) 2011-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -75,15 +75,17 @@ /// If there exists more than one attribute with /// the same sensor channel and type, then a sensor is created only for the /// first attribute. + /// True to hide the sensor initially. public SmartAttribute(byte identifier, string name, RawValueConversion rawValueConversion, SensorType? sensorType, - int sensorChannel) + int sensorChannel, bool defaultHiddenSensor = false) { this.Identifier = identifier; this.Name = name; this.rawValueConversion = rawValueConversion; this.SensorType = sensorType; this.SensorChannel = sensorChannel; + this.DefaultHiddenSensor = defaultHiddenSensor; } /// @@ -97,6 +99,8 @@ public int SensorChannel { get; private set; } + public bool DefaultHiddenSensor { get; private set; } + public bool HasRawValueConversion { get { return rawValueConversion != null; diff -r 07a6126a4796 -r 600962f8a298 Hardware/ISensor.cs --- a/Hardware/ISensor.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/Hardware/ISensor.cs Tue Feb 14 23:07:55 2012 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2011 + Portions created by the Initial Developer are Copyright (C) 2009-2012 the Initial Developer. All Rights Reserved. Contributor(s): @@ -50,8 +50,9 @@ Flow, // L/h Control, // % Level, // % + Factor, // 1 Power, // W - Data, // GB = 2^30 Bytes + Data, // GB = 2^30 Bytes } public struct SensorValue { diff -r 07a6126a4796 -r 600962f8a298 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Mon Feb 13 21:56:29 2012 +0000 +++ b/OpenHardwareMonitor.csproj Tue Feb 14 23:07:55 2012 +0000 @@ -225,6 +225,9 @@ + + + diff -r 07a6126a4796 -r 600962f8a298 Properties/AssemblyVersion.cs --- a/Properties/AssemblyVersion.cs Mon Feb 13 21:56:29 2012 +0000 +++ b/Properties/AssemblyVersion.cs Tue Feb 14 23:07:55 2012 +0000 @@ -37,5 +37,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.4.0.2")] -[assembly: AssemblyInformationalVersion("0.4.0.2 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.4.0.3")] +[assembly: AssemblyInformationalVersion("0.4.0.3 Alpha")] \ No newline at end of file diff -r 07a6126a4796 -r 600962f8a298 Resources/factor.png Binary file Resources/factor.png has changed