Hardware/ATI/ATIGPU.cs
changeset 164 cc1e116d0f2c
parent 134 8b3b9b2e28e5
child 165 813d8bc3192f
     1.1 --- a/Hardware/ATI/ATIGPU.cs	Thu Aug 05 18:06:18 2010 +0000
     1.2 +++ b/Hardware/ATI/ATIGPU.cs	Thu Aug 05 19:28:50 2010 +0000
     1.3 @@ -38,10 +38,9 @@
     1.4  using System;
     1.5  using System.Collections.Generic;
     1.6  using System.Drawing;
     1.7 -using System.Reflection;
     1.8  
     1.9  namespace OpenHardwareMonitor.Hardware.ATI {
    1.10 -  public class ATIGPU : Hardware, IHardware {
    1.11 +  public class ATIGPU : Hardware {
    1.12  
    1.13      private string name;
    1.14      private Image icon;
    1.15 @@ -54,6 +53,7 @@
    1.16      private Sensor memoryClock;
    1.17      private Sensor coreVoltage;
    1.18      private Sensor coreLoad;
    1.19 +    private Sensor fanControl;
    1.20  
    1.21      public ATIGPU(string name, int adapterIndex, int busNumber, 
    1.22        int deviceNumber) 
    1.23 @@ -64,16 +64,14 @@
    1.24        this.busNumber = busNumber;
    1.25        this.deviceNumber = deviceNumber;
    1.26  
    1.27 -      ADLFanSpeedInfo speedInfo = new ADLFanSpeedInfo();
    1.28 -      ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref speedInfo);
    1.29 -
    1.30        this.temperature = 
    1.31          new Sensor("GPU Core", 0, SensorType.Temperature, this);
    1.32 -      this.fan = new Sensor("GPU", 0, SensorType.Fan, this, null);
    1.33 +      this.fan = new Sensor("GPU Fan", 0, SensorType.Fan, this, null);
    1.34        this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
    1.35        this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
    1.36        this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
    1.37        this.coreLoad = new Sensor("GPU Core", 0, SensorType.Load, this);
    1.38 +      this.fanControl = new Sensor("GPU Fan", 0, SensorType.Control, this);
    1.39        Update();                   
    1.40      }
    1.41  
    1.42 @@ -101,7 +99,7 @@
    1.43          temperature.Value = 0.001f * adlt.Temperature;
    1.44          ActivateSensor(temperature);
    1.45        } else {
    1.46 -        DeactivateSensor(temperature);
    1.47 +        temperature.Value = null;
    1.48        }
    1.49  
    1.50        ADLFanSpeedValue adlf = new ADLFanSpeedValue();
    1.51 @@ -112,7 +110,17 @@
    1.52          fan.Value = adlf.FanSpeed;
    1.53          ActivateSensor(fan);
    1.54        } else {
    1.55 -        DeactivateSensor(fan);
    1.56 +        fan.Value = null;
    1.57 +      }
    1.58 +
    1.59 +      adlf = new ADLFanSpeedValue();
    1.60 +      adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
    1.61 +      if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
    1.62 +        == ADL.ADL_OK) {
    1.63 +        fanControl.Value = adlf.FanSpeed;
    1.64 +        ActivateSensor(fanControl);
    1.65 +      } else {
    1.66 +        fanControl.Value = null;
    1.67        }
    1.68  
    1.69        ADLPMActivity adlp = new ADLPMActivity();
    1.70 @@ -137,10 +145,10 @@
    1.71          coreLoad.Value = Math.Min(adlp.ActivityPercent, 100);                        
    1.72          ActivateSensor(coreLoad);
    1.73        } else {
    1.74 -        DeactivateSensor(coreClock);
    1.75 -        DeactivateSensor(memoryClock);
    1.76 -        DeactivateSensor(coreVoltage);
    1.77 -        DeactivateSensor(coreLoad);
    1.78 +        coreClock.Value = null;
    1.79 +        memoryClock.Value = null;
    1.80 +        coreVoltage.Value = null;
    1.81 +        coreLoad.Value = null;
    1.82        }
    1.83      }
    1.84    }