Esempio n. 1
0
        internal double GetSecondary12VCurrent(int page)
        {
            DisabledCheck();

            byte[] ret;

            using (var localMutexLock = CorsairRootDevice.usbGlobalMutex.GetLock())
            {
                SetMainPage(0);
                SetSecondary12VPage(page);
                ret = ReadRegister(0xE8, 2);
            }

            return(BitCodec.ToFloat(ret));
        }
        protected virtual void ReadValues()
        {
            byte[] retVoltage, retCurrent, retPower;

            using (var localMutexLock = CorsairRootDevice.usbGlobalMutex.GetLock())
            {
                SetPage();
                retVoltage = ReadRegister(0x8B, 2);
                retCurrent = ReadRegister(0x8C, 2);
                retPower   = ReadRegister(0x96, 2);
            }

            cachedVoltage = BitCodec.ToFloat(retVoltage);
            cachedCurrent = BitCodec.ToFloat(retCurrent);
            cachedPower   = BitCodec.ToFloat(retPower);
        }
        protected override void ReadValues()
        {
            byte[] retVoltage, retCurrent, retPower, retPowerIn;

            using (var localMutexLock = CorsairRootDevice.usbGlobalMutex.GetLock())
            {
                SetPage();
                retVoltage = ReadRegister(0x88, 2);
                if (psuDevice is LinkDevicePSUHX)
                {
                    retCurrent = null;
                    retPowerIn = null;
                }
                else
                {
                    retCurrent = ReadRegister(0x89, 2);
                    retPowerIn = ReadRegister(0x97, 2);
                }
                retPower = ReadRegister(0xEE, 2);
            }

            cachedVoltage = BitCodec.ToFloat(retVoltage);
            cachedPower   = BitCodec.ToFloat(retPower);
            if (retCurrent == null)
            {
                cachedCurrent = cachedPower / cachedVoltage;
            }
            else
            {
                cachedCurrent = BitCodec.ToFloat(retCurrent);
            }
            if (retPowerIn == null)
            {
                cachedPowerIn = 0;
            }
            else
            {
                cachedPowerIn = (BitCodec.ToFloat(retPowerIn) + (cachedCurrent * cachedVoltage)) / 2.0;
            }

            PowerData adjustedData = PowerCurves.Interpolate(new PowerData(cachedPowerIn, cachedPower), cachedVoltage, psuDevice);

            cachedEfficiency = adjustedData.efficiency;
            cachedPowerIn    = adjustedData.powerIn;
            cachedPower      = adjustedData.powerOut;
        }
Esempio n. 4
0
 protected override object GetValueInternal()
 {
     DisabledCheck();
     return(BitCodec.ToFloat(device.ReadRegister(0x90, 2), 0));
 }