Beispiel #1
0
        private void Numeric_Acceleration_ValueChanged(object sender, EventArgs e)
        {
            decimal value = constrain(Numeric_Acceleration.Value, MotorizedStage.Commands.Acceleration.MinimumValue, MotorizedStage.Commands.Acceleration.MaximumValue);

            if (stage.TrySendCommand(new MotorizedStage.Commands.Acceleration(1, value)))
            {
                decimal read;
                if (stage.TrySendCommand(new MotorizedStage.Commands.Acceleration(1, true), out read))
                {
                    Numeric_Acceleration.ChangeValueWithoutEvent(read, Numeric_Acceleration_ValueChanged);
                    return;
                }
            }

            stageError();
        }
Beispiel #2
0
        public bool UpdateAllStageValues()
        {
            bool successful = true;

            decimal maxVelocity;

            Numeric_TravelVelocity.Maximum = (successful &= stage.TrySendCommand(new MotorizedStage.Commands.MaxVelocity(1), out maxVelocity)) ? maxVelocity : MotorizedStage.Commands.TravelVelocity.MaximumValue;
            decimal currentVelocity;

            if (successful &= stage.TrySendCommand(new MotorizedStage.Commands.TravelVelocity(1, true), out currentVelocity))
            {
                Numeric_TravelVelocity.ChangeValueWithoutEvent(currentVelocity, Numeric_TravelVelocity_ValueChanged);
            }

            decimal maxAcceleration;
            bool    readAccel = stage.TrySendCommand(new MotorizedStage.Commands.MaxAcceleration(1, true), out maxAcceleration);

            Numeric_Acceleration.Maximum = (successful &= readAccel) ? maxAcceleration : MotorizedStage.Commands.Acceleration.MaximumValue;
            decimal currentAcceleration;

            if (successful &= stage.TrySendCommand(new MotorizedStage.Commands.Acceleration(1, true), out currentAcceleration))
            {
                Numeric_Acceleration.ChangeValueWithoutEvent(currentAcceleration, Numeric_Acceleration_ValueChanged);
            }

            Numeric_Deceleration.Maximum = (successful &= readAccel) ? maxAcceleration : MotorizedStage.Commands.Deceleration.MaximumValue;
            decimal currentDeceleration;

            if (successful &= stage.TrySendCommand(new MotorizedStage.Commands.Deceleration(1, true), out currentDeceleration))
            {
                Numeric_Deceleration.ChangeValueWithoutEvent(currentDeceleration, Numeric_Deceleration_ValueChanged);
            }

            Numeric_JogVelocityActual.Maximum = Numeric_TravelVelocity.Value;
            Numeric_JogVelocityPercent_ValueChanged(null, null);             //Sets the "JogVelocityActual" value.
            //Numeric_JogVelocityActual.Value = Numeric_TravelVelocity.Value * Numeric_JogVelocityPercent.Value / 100.0M;

            Numeric_JogAcceleration.Maximum = (readAccel) ? maxAcceleration : MotorizedStage.Commands.JogAcceleration.MaximumValue;
            decimal jogAccel;

            if (successful &= stage.TrySendCommand(new MotorizedStage.Commands.JogAcceleration(1, true), out jogAccel))
            {
                Numeric_JogAcceleration.ChangeValueWithoutEvent(jogAccel, Numeric_JogAcceleration_ValueChanged);
            }

            return(successful);
        }