Beispiel #1
0
        /// <summary> Homes the given device. </summary>
        /// <param name="device"> The device. </param>
        public static bool Home_2(IGenericAdvancedMotor device)
        {
            Console.WriteLine("Homing device");

            // call home function, passing in message complete handler provided by device
            Action <UInt64> workDone = device.InitializeWaitHandler();

            // call home function, passing in event handler
            device.Home(workDone);
            device.Wait(60000);

            // check status
            bool homed = device.Status.IsHomed;

            Console.WriteLine("Device Homed");
            return(true);
        }
Beispiel #2
0
        /// <summary> Move to. </summary>
        /// <param name="device">			   The device. </param>
        /// <param name="position">			   The position. </param>
        /// <param name="deviceUnitConverter"> The device unit converter. </param>
        public static bool MoveTo_2(IGenericAdvancedMotor device, decimal position, DeviceUnitConverter deviceUnitConverter)
        {
            int iPos = deviceUnitConverter.RealToDeviceUnit(position, DeviceUnitConverter.UnitType.Length);

            Console.WriteLine("Moving Device to {0} ({1})", position, iPos);

            // call moveto function, passing in message complete handler provided by device
            Action <UInt64> workDone = device.InitializeWaitHandler();

            device.MoveTo_DeviceUnit(iPos, workDone);
            device.Wait(60000);

            StatusBase status = device.Status;
            Decimal    newPos = status.Position;

            Console.WriteLine("Device Moved to {0}({1})", newPos, position);
            return(true);
        }