コード例 #1
0
        public override void Update()
        {
            int adlt = 0;

            if (ADL.ADL_Overdrive6_Temperature_Get(adapterIndex, ref adlt) == ADL.ADL_OK)
            {
                temperature.Value = 0.001f * adlt;
                ActivateSensor(temperature);
            }
            else
            {
                temperature.Value = null;
            }

            ADLOD6FanSpeedInfo adlf = new ADLOD6FanSpeedInfo();

            adlf.iSpeedType = ADL.ADL_OD6_FANSPEED_TYPE_RPM;
            if (ADL.ADL_Overdrive6_FanSpeed_Get(adapterIndex, ref adlf) == ADL.ADL_OK)
            {
                fan.Value = adlf.iFanSpeedRPM;
                ActivateSensor(fan);
            }
            else
            {
                fan.Value = null;
            }

            //adlf = new _ADLOD6FanSpeedValue();
            adlf.iSpeedType = ADL.ADL_OD6_FANSPEED_TYPE_PERCENT;
            if (ADL.ADL_Overdrive6_FanSpeed_Get(adapterIndex, ref adlf) == ADL.ADL_OK)
            {
                controlSensor.Value = adlf.iFanSpeedPercent;
                ActivateSensor(controlSensor);
            }
            else
            {
                controlSensor.Value = null;
            }

            ADLOD6CurrentStatus adlcs = new ADLOD6CurrentStatus();

            if (ADL.ADL_Overdrive6_CurrentStatus_Get(adapterIndex, ref adlcs) == ADL.ADL_OK)
            {
                if (adlcs.iEngineClock > 0)
                {
                    coreClock.Value = 0.01f * adlcs.iEngineClock;
                    ActivateSensor(coreClock);
                }
                else
                {
                    coreClock.Value = null;
                }

                if (adlcs.iMemoryClock > 0)
                {
                    memoryClock.Value = 0.01f * adlcs.iMemoryClock;
                    ActivateSensor(memoryClock);
                }
                else
                {
                    memoryClock.Value = null;
                }
                int curval, defaultval = 0;
                if (ADL.ADL_Overdrive6_VoltageControl_Get(adapterIndex, out curval, out defaultval) != ADL.ADL_OK)
                {
                    coreVoltage.Value = 0.001f * curval;
                    ActivateSensor(coreVoltage);
                }
                else
                {
                    coreVoltage.Value = null;
                }

                coreLoad.Value = Math.Min(adlcs.iActivityPercent, 100);
                ActivateSensor(coreLoad);
            }
            else
            {
                coreClock.Value   = null;
                memoryClock.Value = null;
                coreVoltage.Value = null;
                coreLoad.Value    = null;
            }
        }