Пример #1
0
        internal JoyStickChannel(string ChannelName, MotorSimulation Motor, double Value, double PosLimit, double NegLimit)
        {
            channelName = ChannelName;
            motor       = Motor;
            upperLmt    = PosLimit;
            lowerLmt    = NegLimit;

            backupValue  = Value;
            currentValue = Value;
            Bond();
        }
Пример #2
0
        async Task <bool> CheckMotionStatusDoneAsyn(MotorSimulation Motor)
        {
            var task = Task.Run(async() =>
            {
                await Task.Yield();
                while (Motor.Status == MotorSimulation.StatusEnum.EXECUTING)
                {
                }
            });

            return(await Task.WhenAny(task, Task.Delay(10000)) == task);
        }
Пример #3
0
        public async Task TriggerCommandAsync(DirectionEnum Dir)
        {
            int set = (int)mCurrentChannelSet;

            mCurDirection = Dir;
            bool syncX = false;
            bool syncY = false;

            if (mChannelSets[set].ChannelX != null && IsVectorX())
            {
                SetJoyCurSpeedModeX();
                syncX = mChannelSets[set].ChannelX.Increment(mFactorX * StepX());
            }
            if (mChannelSets[set].ChannelY != null && IsVectorY())
            {
                SetJoyCurSpeedModeY();
                syncY = mChannelSets[set].ChannelY.Increment(mFactorY * StepY());
            }
            if (syncX || syncY)
            {
                CallBackFunction(mCallback);
            }


            if (syncX)
            {
                MotorSimulation motor = mChannelSets[set].ChannelX.GetMotor();
                var             task  = CheckMotionStatusDoneAsyn(motor);
                FailureHandling(await task);
            }
            if (syncY)
            {
                MotorSimulation motor = mChannelSets[set].ChannelY.GetMotor();
                var             task  = CheckMotionStatusDoneAsyn(motor);
                FailureHandling(await task);
            }
        }
Пример #4
0
        public void SetYChannel(string Name, int Value, MotorSimulation Motor, double PosLimit = 9999, double NegLimit = 9999, SETEnum Set = SETEnum.ONE)
        {
            int set = (int)Set;

            mChannelSets[set].ChannelY = new JoyStickChannel(Name, Motor, Value, PosLimit, NegLimit);
        }