Пример #1
0
 private void InIn_Click(object sender, EventArgs e)
 {
     if (myFocuser.Connected)
     {
         focuser_step_value = focuser_step_value - 100;
         myFocuser.Move(focuser_step_value);
         current_focuser_value.Text = focuser_step_value.ToString();
     }
 }
Пример #2
0
        /// <summary>
        /// Tests
        /// </summary>
        /// <param name="moveSteps">Number of steps for each move in/out.</param>
        /// <param name="numberOfLoops">Number of test loops.</param>
        private static void MoveTest(int moveSteps, int numberOfLoops)
        {
            Console.WriteLine("{0}Move Test vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", Environment.NewLine);

            MoveToZero();

            for (int loops = 0; loops < numberOfLoops; loops++)
            {
                int nfp = (int)(s_Focuser.Position + moveSteps);

                for (int ii = 0; ii < 5; ii++)
                {
                    int moveTo = nfp + moveSteps * ii;
                    Console.Write("\tMoving to {0} ", moveTo);
                    s_Focuser.Move(moveTo);

                    while (s_Focuser.IsMoving)
                    {
                        Console.Write(".");
                        Thread.Sleep(50);
                    }

                    Console.WriteLine("{0}\tFocuser is now at {1}", Environment.NewLine, s_Focuser.Position);
                }

                // Get position again.
                nfp = s_Focuser.Position;

                for (int ii = 0; ii <= 5; ii++)
                {
                    int moveTo = nfp - moveSteps * ii;
                    Console.Write("\tMoving to {0} ", moveTo);
                    s_Focuser.Move(moveTo);

                    while (s_Focuser.IsMoving)
                    {
                        Console.Write(".");
                        Thread.Sleep(50);
                    }

                    Console.WriteLine("{0}\tFocuser is now at {1}", Environment.NewLine, s_Focuser.Position);
                }

                Console.WriteLine("Completed test loop {0}", loops + 1);
            }

            Console.WriteLine("Move Test ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ {0}", Environment.NewLine);
        }
Пример #3
0
        static void Main(string[] args)
        {
            // General information
            Console.WriteLine("This program is running in {0}-bit mode", (IntPtr.Size == 4) ? "32" : "64");
            Console.WriteLine();

            DriverAccess.Focuser device;
            //ASCOM.DeviceInterface.IFocuserV3 device = new ASCOM.Ardufocus.Focuser();

            try
            {
                // Select the driver
                device = new DriverAccess.Focuser("ASCOM.Ardufocus.Focuser.1");
            }
            catch (Exception)
            {
                Console.WriteLine("ASCOM.Ardufocus.Focuser driver not found.");
                Console.WriteLine("Press Enter to finish");
                Console.ReadLine();
                return;
            }

            // Basic driver information
            Console.WriteLine("          Name: " + device.Name);
            Console.WriteLine("   Description: " + device.Description);
            Console.WriteLine("   Driver Info: " + device.DriverInfo);
            Console.WriteLine("Driver Version: " + device.DriverVersion);
            Console.WriteLine();

#if USE_SETUP
            // Show the driver setup dialog
            device.SetupDialog();
#endif

            // Connect
            device.Connected = true;

            if (device.Connected)
            {
                // Driver tests
                Console.WriteLine("         Absolute: " + device.Absolute);
                Console.WriteLine("        Connected: " + device.Connected);
                Console.WriteLine("        Interface: " + device.InterfaceVersion);
                Console.WriteLine("         IsMoving: " + device.IsMoving);
                Console.WriteLine("             Link: " + device.Link);
                Console.WriteLine("     MaxIncrement: " + device.MaxIncrement);
                Console.WriteLine("          MaxStep: " + device.MaxStep);
                Console.WriteLine("         Position: " + device.Position);

                // This one throws an exception
                //Console.WriteLine("         StepSize: " + device.StepSize);

                Console.WriteLine(" SupportedActions: " + device.SupportedActions);
                Console.WriteLine("         TempComp: " + device.TempComp);
                Console.WriteLine("TempCompAvailable: " + device.TempCompAvailable);
                Console.WriteLine("      Temperature: " + device.Temperature);
                Console.WriteLine();

                // Finish
                Console.WriteLine("Press Enter to test movement");
                Console.ReadLine();

                int target = 1234;
                device.Move(target);
                Console.WriteLine("Moving focuser to position {0}", target);

                while (device.IsMoving)
                {
                    ;
                }
                Console.WriteLine("Focuser stopped moving, current position is {0}", device.Position);

                int home = 0;
                device.Move(home);
                Console.WriteLine("Moving focuser to position {0}", home);

                while (device.IsMoving)
                {
                    ;
                }
                Console.WriteLine("Focuser stopped moving, current position is {0}", device.Position);

                device.Connected = false;
            }

            // Finish
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }