Example #1
0
        void HomeAsync(int axis, double speed)
        {
            var a      = Axis.Of(axis);
            var pls_ms = speed / 1000.0;
            var acc_ms = (speed * 10.0) / (1000.0 * 1000.0);

            N.GT_ClrSts(card, a, 1).Verify();
            N.GT_AxisOn(card, a).Verify();
            N.GT_SetCaptureMode(card, a, Api.CAPTURE_HOME).Verify();
            N.GT_ZeroPos(card, a, 1).Verify();
            Offset(axis, -10000000, speed, 0.01, 0.01);

            Task.Run(async() =>
            {
                try
                {
                    short cap = 0;
                    int pos   = 0;
                    do
                    {
                        N.GT_GetCaptureStatus(card, a, out cap, out pos).Verify();
                        if (cap != 0)
                        {
                            N.GT_SetPos(card, a, pos).Verify();
                            N.GT_Update(card, a.Mask).Verify();
                            break;
                        }
                        await Task.Delay(1);
                    } while (!IsStop(axis));

                    while (!IsStop(axis))
                    {
                        await Task.Delay(1);
                    }

                    return(cap != 0);
                }
                catch (Exception)
                {
                    return(false);
                }
            });
        }
Example #2
0
 public void ZeroPosition(int axis)
 {
     N.GT_ZeroPos(card, Axis.Of(axis), 1).Verify();
 }