# HG changeset patch # User moel.mich # Date 1264975231 0 # Node ID 0e812fe67bacb4c57e450ecf3f426abd0ff79ab6 # Parent 51c2f209da6d38dba1e90971fdbce5c1e6065f11 Release version 0.1.6. Fixed F71882 temperature reading. Added error handling for ATI GPUs (ADL). Fixed sensor events. diff -r 51c2f209da6d -r 0e812fe67bac Hardware/ATI/ADL.cs --- a/Hardware/ATI/ADL.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/ATI/ADL.cs Sun Jan 31 22:00:31 2010 +0000 @@ -110,7 +110,7 @@ public const int ADL_MAX_DISPLAYS = 40; public const int ADL_MAX_DEVICENAME = 32; public const int ADL_OK = 0; - public const int ADL_FAIL = -1; + public const int ADL_ERR = -1; public const int ADL_DRIVER_OK = 0; public const int ADL_MAX_GLSYNC_PORTS = 8; public const int ADL_MAX_GLSYNC_PORT_LEDS = 8; diff -r 51c2f209da6d -r 0e812fe67bac Hardware/ATI/ATIGPU.cs --- a/Hardware/ATI/ATIGPU.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/ATI/ATIGPU.cs Sun Jan 31 22:00:31 2010 +0000 @@ -54,6 +54,8 @@ private Sensor memoryClock; private Sensor coreVoltage; + private List active = new List(); + public ATIGPU(string name, int adapterIndex, int busNumber, int deviceNumber) { @@ -92,10 +94,7 @@ } public ISensor[] Sensors { - get { - return new ISensor[] { coreVoltage, coreClock, memoryClock, temperature, - fan }; - } + get { return active.ToArray(); } } public string GetReport() { @@ -104,24 +103,60 @@ public void Update() { ADLTemperature adlt = new ADLTemperature(); - ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt); - temperature.Value = 0.001f * adlt.Temperature; + if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt) + == ADL.ADL_OK) + { + temperature.Value = 0.001f * adlt.Temperature; + ActivateSensor(temperature); + } else { + DeactivateSensor(temperature); + } ADLFanSpeedValue adlf = new ADLFanSpeedValue(); adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM; - ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf); - fan.Value = adlf.FanSpeed; + if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf) + == ADL.ADL_OK) + { + fan.Value = adlf.FanSpeed; + ActivateSensor(fan); + } else { + DeactivateSensor(fan); + } ADLPMActivity adlp = new ADLPMActivity(); - ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp); - coreClock.Value = 0.01f * adlp.EngineClock; - memoryClock.Value = 0.01f * adlp.MemoryClock; - coreVoltage.Value = 0.001f * adlp.Vddc; + if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp) + == ADL.ADL_OK) + { + coreClock.Value = 0.01f * adlp.EngineClock; + memoryClock.Value = 0.01f * adlp.MemoryClock; + coreVoltage.Value = 0.001f * adlp.Vddc; + ActivateSensor(coreClock); + ActivateSensor(memoryClock); + ActivateSensor(coreVoltage); + } else { + DeactivateSensor(coreClock); + DeactivateSensor(memoryClock); + DeactivateSensor(coreVoltage); + } } - #pragma warning disable 67 + private void ActivateSensor(Sensor sensor) { + if (!active.Contains(sensor)) { + active.Add(sensor); + if (SensorAdded != null) + SensorAdded(sensor); + } + } + + private void DeactivateSensor(Sensor sensor) { + if (active.Contains(sensor)) { + active.Remove(sensor); + if (SensorRemoved != null) + SensorRemoved(sensor); + } + } + public event SensorEventHandler SensorAdded; public event SensorEventHandler SensorRemoved; - #pragma warning restore 67 } } diff -r 51c2f209da6d -r 0e812fe67bac Hardware/LPC/F71882.cs --- a/Hardware/LPC/F71882.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/LPC/F71882.cs Sun Jan 31 22:00:31 2010 +0000 @@ -146,9 +146,10 @@ } foreach (Sensor sensor in temperatures) { - int value = ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index)); + sbyte value = (sbyte)ReadByte((byte)( + TEMPERATURE_BASE_REG + 2 * sensor.Index)); sensor.Value = value; - if (value < 254) + if (value < sbyte.MaxValue && value > 0) ActivateSensor(sensor); else DeactivateSensor(sensor); @@ -170,14 +171,16 @@ private void ActivateSensor(Sensor sensor) { if (!active.Contains(sensor)) { active.Add(sensor); - SensorAdded(sensor); + if (SensorAdded != null) + SensorAdded(sensor); } } private void DeactivateSensor(Sensor sensor) { if (active.Contains(sensor)) { active.Remove(sensor); - SensorRemoved(sensor); + if (SensorRemoved != null) + SensorRemoved(sensor); } } diff -r 51c2f209da6d -r 0e812fe67bac Hardware/LPC/IT87.cs --- a/Hardware/LPC/IT87.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/LPC/IT87.cs Sun Jan 31 22:00:31 2010 +0000 @@ -205,14 +205,16 @@ private void ActivateSensor(Sensor sensor) { if (!active.Contains(sensor)) { active.Add(sensor); - SensorAdded(sensor); + if (SensorAdded != null) + SensorAdded(sensor); } } private void DeactivateSensor(Sensor sensor) { if (active.Contains(sensor)) { active.Remove(sensor); - SensorRemoved(sensor); + if (SensorRemoved != null) + SensorRemoved(sensor); } } diff -r 51c2f209da6d -r 0e812fe67bac Hardware/LPC/W83627DHG.cs --- a/Hardware/LPC/W83627DHG.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/LPC/W83627DHG.cs Sun Jan 31 22:00:31 2010 +0000 @@ -239,14 +239,16 @@ private void ActivateSensor(Sensor sensor) { if (!active.Contains(sensor)) { active.Add(sensor); - SensorAdded(sensor); + if (SensorAdded != null) + SensorAdded(sensor); } } private void DeactivateSensor(Sensor sensor) { if (active.Contains(sensor)) { active.Remove(sensor); - SensorRemoved(sensor); + if (SensorRemoved != null) + SensorRemoved(sensor); } } diff -r 51c2f209da6d -r 0e812fe67bac Hardware/TBalancer/TBalancer.cs --- a/Hardware/TBalancer/TBalancer.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Hardware/TBalancer/TBalancer.cs Sun Jan 31 22:00:31 2010 +0000 @@ -81,7 +81,8 @@ deactivating.Remove(sensor); if (!active.Contains(sensor)) { active.Add(sensor); - SensorAdded(sensor); + if (SensorAdded != null) + SensorAdded(sensor); } } @@ -89,7 +90,8 @@ if (deactivating.Contains(sensor)) { active.Remove(sensor); deactivating.Remove(sensor); - SensorRemoved(sensor); + if (SensorRemoved != null) + SensorRemoved(sensor); } else if (active.Contains(sensor)) { deactivating.Add(sensor); } diff -r 51c2f209da6d -r 0e812fe67bac Properties/AssemblyInfo.cs --- a/Properties/AssemblyInfo.cs Sun Jan 31 20:57:18 2010 +0000 +++ b/Properties/AssemblyInfo.cs Sun Jan 31 22:00:31 2010 +0000 @@ -69,5 +69,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.5.0")] -[assembly: AssemblyFileVersion("0.1.5.0")] +[assembly: AssemblyVersion("0.1.6.0")] +[assembly: AssemblyFileVersion("0.1.6.0")]