Ejemplo n.º 1
0
        public override void OnDeviceRegistersRead(string Name)
        {
            base.OnDeviceRegistersRead(Name);

            switch (Name)
            {
            case "PARAMS":
                _PARAMS_PREV  = (UInt16[])_PARAMS.Clone();
                CurrentParams = new NptParam();
                int sclass = _PARAMS[9] & 0xf, stype = _PARAMS[9] >> 8;

                CurrentParams.Sensor = AppManager.Worker.FindSensor(DEVTYPE, new SensorUID()
                {
                    Class = sclass, Senstype = stype
                });
                CurrentParams.Sensor.MaxScale = ByteArrayHelpers.ReadSingle(_PARAMS, 2);
                CurrentParams.Sensor.MinScale = ByteArrayHelpers.ReadSingle(_PARAMS, 0);
                CurrentParams.SetErrorState(ByteArrayHelpers.ReadSingle(_PARAMS, 4));
                CurrentParams.Ftime       = ByteArrayHelpers.ReadSingle(_PARAMS, 6);
                CurrentParams.ModeTermRes = _PARAMS[8] >> 8;
                CurrentParams.ColdSold    = (_PARAMS[8] & 0xf) == 1;
                break;

            case "STATE":
                OutCurrent      = ByteArrayHelpers.ReadSingle(_STATE, 0x18);
                Tempr           = ByteArrayHelpers.ReadSingle(_STATE, 0x14);
                DeviceError     = (ushort)(_STATE[0x1A] << 16);
                DeviceError    |= _STATE[0x1B];
                ShowDeviceError = (((DeviceError & 64) == 64) || ((DeviceError & 128) == 128));
                break;
            }
        }
Ejemplo n.º 2
0
        public override void SetParams(NptParam input)
        {
            _PARAMS_PREV = (UInt16[])_PARAMS.Clone();

            ByteArrayHelpers.WriteSingle(ref _PARAMS, 0, input.Sensor.MinScale);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 2, input.Sensor.MaxScale);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 4, input.GetErrorState());
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 6, input.Ftime);
            _PARAMS[8]  = (ushort)(input.ModeTermRes << 8);
            _PARAMS[8] |= (ushort)(input.ColdSold ? 0 : 1);
            _PARAMS[9]  = (ushort)(input.Sensor.SensorUID.Senstype << 8);
            _PARAMS[9] |= (ushort)input.Sensor.SensorUID.Class;
        }
Ejemplo n.º 3
0
        public virtual void SetCalibParams(CalibrateParam input)
        {
            NptParam param = new NptParam()
            {
                Sensor = new Sensor()
                {
                    SensorUID = input.Sensor.SensorUID
                },
                MinValue = input.MinValue,
                MaxValue = input.MaxValue
            };

            SetParams(param);
        }
Ejemplo n.º 4
0
        public override void SetParams(NptParam input0)
        {
            _PARAMS_PREV = (UInt16[])_PARAMS.Clone();
            NptParam_1KEX input = (NptParam_1KEX)input0;

            ByteArrayHelpers.WriteSingle(ref _PARAMS, 0, input.ErrOut5);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 2, input.ErrOut4);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 4, input.ErrOut3);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 6, input.ErrOut2);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 8, input.ErrOut1);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 10, input.ErrOut0);
            _PARAMS[12] = (ushort)input.ModeOut;
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 13, input.Ftime);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 15, input.MaxValue);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 17, input.MinValue);
            _PARAMS[19] = (ushort)input.FuncSqrt;
            _PARAMS[20] = (ushort)input.ModeTermRes;
            _PARAMS[21] = (ushort)(input.ColdSold ? 1 : 0);
            _PARAMS[22] = (ushort)input.Sensor.SensorUID.Senstype;
            _PARAMS[23] = (ushort)input.Sensor.SensorUID.Class;
        }
Ejemplo n.º 5
0
 public virtual void SetParams(NptParam nptParam)
 {
     throw new Exception("Not implemented yet");
 }