Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        #region Connect devices and get its status

        /// <summary>
        /// Connect cameras in MaximDL
        /// </summary>
        /// <returns></returns>
        public string ConnectCamera(bool ConnectDisconnectFlag = true)
        {
            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                if (ConnectDisconnectFlag)
                {
                    CCDCamera.LinkEnabled = true;
                    Logging.AddLog("MaximDL camera connected", LogLevel.Activity);
                    return("Camera connected");
                }
                else
                {
                    CCDCamera.LinkEnabled = false;
                    Logging.AddLog("MaximDL camera disconnected", LogLevel.Activity);
                    return("Camera disconnected");
                }
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL camera connection failed", ex, LogLevel.Important);

                return("Camera connection failed");
            }
        }
Exemplo n.º 2
0
        private void handlePacket(string text)
        {
            switch (text)
            {
            case "setup_ccd":
                try
                {
                    ccd             = new MaxIm.CCDCamera();
                    ccd.LinkEnabled = true;
                    AppendToTextBox("Client Camera Is Ready!");
                    sendToServer("Client Camera Is Ready!");
                }
                catch (Exception ex)
                {
                    AppendToTextBox("Cant Connect To Client Camera");
                    sendToServer("Cant Connect To Client Camera");
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            case "teardown_ccd":
                try
                {
                    ccd.LinkEnabled = false;
                    AppendToTextBox("Client Camera Is Disconnected!");
                    sendToServer("Client Camera Is Disconnected!");
                }
                catch (Exception ex)
                {
                    AppendToTextBox("Cant Connect To Client Camera");
                    sendToServer("Cant Connect To Client Camera");
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            case "expose_ccd":
                ccd.Expose(1, 1, 0);

                while (!ccd.ImageReady)
                {
                    //wait
                }
                AppendToTextBox("Client Exposure Is Done!");
                sendToServer("Client Exposure Is Done!");
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();

            DeviceManagerCLI.BuildDeviceList();

            List <string> serialNumbers = DeviceManagerCLI.GetDeviceList(TCubeDCServo.DevicePrefix);

            richTextBox1.Text = serialNumbers.Count().ToString();

            for (int i = 0; i < serialNumbers.Count(); i++)
            {
                device[i] = TCubeDCServo.CreateTCubeDCServo(serialNumbers[i]);

                device[i].Connect(serialNumbers[i]);
                if (!device[i].IsSettingsInitialized())
                {
                    device[i].WaitForSettingsInitialized(5000);
                }

                device[i].StartPolling(250);

                // call GetMotorConfiguration on the device to initialize the DeviceUnitConverter object required for real world unit parameters
                MotorConfiguration motorSettings         = device[i].GetMotorConfiguration(serialNumbers[i]);
                DCMotorSettings    currentDeviceSettings = device[i].MotorDeviceSettings as DCMotorSettings;

                // display info about device
                DeviceInfo deviceInfo = device[i].GetDeviceInfo();
                richTextBox1.AppendText(Environment.NewLine + "Device " + deviceInfo.SerialNumber + " " + deviceInfo.Name + " " + device[i].GetMoveAbsolutePosition().ToString("F4") + Environment.NewLine);
            }

            ccd = new MaxIm.CCDCamera();

            ccd.LinkEnabled = true;

            ccd.MultiStarGuiding = true;

            ccd.GuiderExpose(1.0);

            while (ccd.GuiderRunning)
            {
                Thread.Sleep(1000);
            }

            ccd.GuiderTrack(0.1);

            // Thread.Sleep(1000);

            timer1.Enabled = true;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Switch cooler on, and set main camera cooling temperature
        /// If Maxim isn't running then use it as a TragetSetTemp changing
        /// </summary>
        public string CameraCoolingOn(double SetTemp = TEMP_MIN)
        {
            //Changed logic - no temp given, no settemp
            //if (SetTemp == TEMP_MIN)
            //    SetTemp = TargetCameraSetTemp;
            CameraWarmpUpNow = false;

            if (IsRunning() && MaximApplicationObj != null)
            {
                if (CCDCamera == null)
                {
                    CCDCamera = new MaxIm.CCDCamera();
                }
                try
                {
                    if (CCDCamera.CanSetTemperature)
                    {
                        CCDCamera.CoolerOn = true;
                        //CCDCamera.TemperatureSetpoint = SetTemp; ////////
                        Logging.AddLog("Camera cooler set to " + SetTemp + " deg", LogLevel.Activity);
                        return("Cooler set to " + SetTemp + " deg");
                    }
                    else
                    {
                        Logging.AddLog("Camera can't set temperature", LogLevel.Debug); //'Debug' to not dublicate messages
                        return("Camera can't set temperature");
                    }
                }
                catch (Exception ex)
                {
                    MaximLogError("MaximDL set camera cooling failed!", ex);
                    return("Set camera cooling failed");
                }
            }
            else
            {
                //Change target temperature
                //TargetCameraSetTemp = SetTemp;

                return("MaximDL is not running");
            }
        }
Exemplo n.º 5
0
        public double GetCameraTemp()
        {
            double getTemp = TEMP_MAX;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                getTemp = CCDCamera.Temperature;
                Logging.AddLog("Camera temp is " + getTemp + " deg", LogLevel.Trace);
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL get camera temp failed!", ex);
            }
            CameraTemp = getTemp;
            return(getTemp);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get current Setpoint
        /// </summary>
        /// <returns></returns>
        public double GetCameraSetpoint()
        {
            double setTemp = TEMP_MIN;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                setTemp = CCDCamera.TemperatureSetpoint;
                Logging.AddLog("Camera setpoint is " + setTemp + " deg", LogLevel.Trace);
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL camera temp setpoint failed!", ex);
            }
            CameraSetPoint = setTemp;
            return(setTemp);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Check if cooler ON/OFF
        /// </summary>
        /// <returns></returns>
        private bool GetCoolerStatus()
        {
            bool getCoolerStatus = false;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                getCoolerStatus = CCDCamera.CoolerOn;
                Logging.AddLog("Camera cooler is " + (getCoolerStatus ? "on" : "off"), LogLevel.Trace);
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL get camera cooler status failed!", ex);
            }
            CameraCoolerOnStatus = getCoolerStatus;
            return(getCoolerStatus);
        }
Exemplo n.º 8
0
        public short GetCoolerPower()
        {
            short getPower = -1;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                getPower = CCDCamera.CoolerPower;
                Logging.AddLog("Camera cooler power is " + getPower + "%", LogLevel.Trace);
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL get camera cooler power failed!", ex);
            }

            CameraCoolerPower = getPower;
            return(getPower);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Switch cooler off
        /// </summary>
        public string CameraCoolingOff(bool WarmUpFlag = false)
        {
            double WarmUpSetTemp = 50.0;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                if (WarmUpFlag)
                {
                    if (CCDCamera.CanSetTemperature)
                    {
                        CCDCamera.TemperatureSetpoint = WarmUpSetTemp;
                        CameraWarmpUpNow = true;
                        Logging.AddLog("Cooler warmup set to " + WarmUpSetTemp + " deg", LogLevel.Activity);
                        return("Cooler warmup set to " + WarmUpSetTemp + " deg");
                    }
                    else
                    {
                        CameraWarmpUpNow = false;
                        Logging.AddLog("Camera can't set temperature", LogLevel.Activity);
                        return("Camera can't set temperature");
                    }
                }
                else
                {
                    CCDCamera.CoolerOn = false;
                    CameraWarmpUpNow   = false;
                    Logging.AddLog("Cooler switched off", LogLevel.Activity);
                    return("Cooler switched off");
                }
            }
            catch (Exception ex)
            {
                MaximLogError("MaximDL switch camera cooling off failed!", ex);
                return("Switch camera cooling off failed ");
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// GetGuiderParams
        /// </summary>
        /// <returns></returns>
        public double[] GetGuiderParams()
        {
            double guiderAngel  = 0.0;
            double guiderXSpeed = 0.0;
            double guiderYSpeed = 0.0;

            if (CCDCamera == null)
            {
                CCDCamera = new MaxIm.CCDCamera();
            }
            try
            {
                guiderAngel  = CCDCamera.GuiderAngle;
                guiderXSpeed = CCDCamera.GuiderXSpeed;
                guiderYSpeed = CCDCamera.GuiderYSpeed;
                Logging.AddLog("Guider angel: " + guiderAngel + " X speed: " + guiderXSpeed + " Y speed: " + guiderYSpeed, LogLevel.Activity);
            }
            catch (Exception ex)
            {
                StackTrace   st      = new StackTrace(ex, true);
                StackFrame[] frames  = st.GetFrames();
                string       messstr = "";

                // Iterate over the frames extracting the information you need
                foreach (StackFrame frame in frames)
                {
                    messstr += String.Format("{0}:{1}({2},{3})", frame.GetFileName(), frame.GetMethod().Name, frame.GetFileLineNumber(), frame.GetFileColumnNumber());
                }

                string FullMessage = "MaximDL get guider aggressiveness failed!" + Environment.NewLine;
                FullMessage += Environment.NewLine + Environment.NewLine + "Debug information:" + Environment.NewLine + "IOException source: " + ex.Data + " " + ex.Message
                               + Environment.NewLine + Environment.NewLine + messstr;
                //MessageBox.Show(this, FullMessage, "Invalid value", MessageBoxButtons.OK);

                Logging.AddLog("Get camera temp failed [" + ex.Message + "]", 0, Highlight.Error);
                Logging.AddLog(FullMessage, LogLevel.Debug, Highlight.Error);
            }
            return(new[] { guiderAngel, guiderXSpeed, guiderYSpeed });
        }
Exemplo n.º 11
0
        private void btnSyncCams_Click(object sender, EventArgs e)
        {
            string syncCam = "setup_ccd";

            byte[] sync = Encoding.ASCII.GetBytes(syncCam);
            _clientSocket.Send(sync);

            try
            {
                ccd             = new MaxIm.CCDCamera();
                ccd.LinkEnabled = true;
                ccd.CoolerOn    = true;
                AppendToTextBox("Server Camera Is Ready!");
                toggleSync(false);
                toggleExpose(true);
            }
            catch (Exception ex)
            {
                AppendToTextBox("cant connect to server camera");
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 12
0
 public void Init()
 {
     CCDCamera           = new MaxIm.CCDCamera();
     MaximApplicationObj = new MaxIm.Application();
 }
Exemplo n.º 13
0
        private void receiveCallback(IAsyncResult ar)
        {
            try
            {
                int received = _clientSocket.EndReceive(ar);

                if (received == 0)
                {
                    IPEndPoint clientIP = (IPEndPoint)_clientSocket.LocalEndPoint;
                    AppendToTextBox("Server " + clientIP.Address.ToString() + " disconnected!");
                    return; //eliminate the beginreceive below... bc client likely disconnected
                }
                Array.Resize(ref _buffer, received);

                string cmd = Encoding.ASCII.GetString(_buffer);
                if (cmd.Equals("setup_ccd"))
                {
                    ccd = new MaxIm.CCDCamera();

                    ccd.DisableAutoShutdown = true;
                    ccd.LinkEnabled         = true;
                    ccd.CoolerOn            = true;
                    AppendToTextBox("Client Camera Is Ready!");
                    sendToServer("Client Camera Is Ready!");
                }
                else if (cmd.Equals("teardown_ccd"))
                {
                    try
                    {
                        ccd.CoolerOn    = false;
                        ccd.LinkEnabled = false;

                        AppendToTextBox("Client Camera Is Disconnected!");
                        sendToServer("Client Camera Is Disconnected!");
                    }
                    catch (Exception ex)
                    {
                        AppendToTextBox("Cant Connect To Client Camera");
                        sendToServer("Cant Connect To Client Camera");
                        MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    ExposePackage recvd = new ExposePackage(_buffer);

                    epsilon    = recvd.epsilon;
                    expTime    = recvd.expTime;
                    isDark     = recvd.isDark;
                    saveImages = recvd.saveImages;
                    if (!clientSetSavePath)
                    {
                        savepath = recvd.savepath;
                    }
                    filter   = recvd.filter;
                    orderPos = recvd.orderPos;

                    waitFor(epsilon);
                    exposeFor(isDark, expTime);

                    while (!ccd.ImageReady)
                    {
                        //wait
                    }

                    string dt = string.Empty;
                    double jd = 0.0;
                    dt = ccd.Document.GetFITSKey("DATE-OBS");
                    AppendToTextBox("client_cam: " + dt);
                    sendToServer(" client_cam: " + dt);
                    jd = ccd.Document.GetFITSKey("JD");
                    AppendToTextBox("client_cam: " + jd.ToString());
                    sendToServer(" client_cam: " + jd.ToString());
                }

                /*
                 * string text = Encoding.ASCII.GetString(_buffer);
                 * //handle the packet
                 * AppendToTextBox(text);
                 * handlePacket(text);*/
                Array.Resize(ref _buffer, _clientSocket.ReceiveBufferSize);

                //restart receive
                _clientSocket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), null);
            }
            catch (Exception ex)
            {
                AppendToTextBox("Server Disconnected!");
                if (!ex.Message.Contains("Cannot access a disposed object"))
                {
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 14
0
        public Main()
        {
            InitializeComponent();

            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }

            derrX[0] = 0; derrX[1] = 0; derrX[2] = 0; derrY[0] = 0; derrY[1] = 0; derrY[2] = 0;



            stopWatch.Start();

            //Get the list of IM devices
            DeviceManagerCLI.BuildDeviceList();

            List <string> serialNumbersTIM = DeviceManagerCLI.GetDeviceList(TCubeInertialMotor.DevicePrefix);

            serialNumbersTDC = DeviceManagerCLI.GetDeviceList(TCubeDCServo.DevicePrefix);

            richTextBox1.AppendText("TIM devices: " + serialNumbersTIM.Count() + " | TDC devices: " + serialNumbersTDC.Count() + Environment.NewLine);

            //Put the devices into an array


            for (int i = 0; i < serialNumbersTDC.Count(); i++)
            {
                devicesTDC[i] = TCubeDCServo.CreateTCubeDCServo(serialNumbersTDC[i]);
                TIM           = false;
            }

            for (int i = 0; i < serialNumbersTIM.Count(); i++)
            {
                //TIM takes preference
                devicesTIM[i] = TCubeInertialMotor.CreateTCubeInertialMotor(serialNumbersTIM[i]);
                TIM           = true;
            }



            if (TIM)
            {
                KpxUD.Value      = (decimal)Properties.Settings.Default.Kpx;
                KixUD.Value      = (decimal)Properties.Settings.Default.Kix;
                KdxUD.Value      = (decimal)Properties.Settings.Default.Kdx;
                KpyUD.Value      = (decimal)Properties.Settings.Default.Kpy;
                KiyUD.Value      = (decimal)Properties.Settings.Default.Kiy;
                KdyUD.Value      = (decimal)Properties.Settings.Default.Kdy;
                minMoveXUD.Value = (decimal)Properties.Settings.Default.minMoveX;
                minMoveYUD.Value = (decimal)Properties.Settings.Default.minMoveY;

                imaxxUD.Value = (decimal)Properties.Settings.Default.imaxX;
                imaxyUD.Value = (decimal)Properties.Settings.Default.imaxY;

                reverseX.Checked = Properties.Settings.Default.revx;
                reverseY.Checked = Properties.Settings.Default.revy;

                deviceTIM = devicesTIM[0];

                //Connect and initialise

                deviceTIM.Connect(serialNumbersTIM[0]);

                if (!deviceTIM.IsSettingsInitialized())
                {
                    deviceTIM.WaitForSettingsInitialized(5000);
                }

                deviceTIM.StartPolling(100);

                // call GetMotorConfiguration on the device to initialize the DeviceUnitConverter object required for real world unit parameters
                //MotorConfiguration motorSettings = device[i].GetMotorConfiguration(serialNumbers[i]);

                InertialMotorConfiguration    motorSettings         = deviceTIM.GetInertialMotorConfiguration(serialNumbersTIM[0]);
                ThorlabsInertialMotorSettings currentDeviceSettings = deviceTIM.InertialMotorDeviceSettings as ThorlabsInertialMotorSettings;

                // display info about device
                DeviceInfo deviceInfo = deviceTIM.GetDeviceInfo();
                richTextBox1.AppendText("Selected device " + deviceInfo.Name + " serial: " + deviceInfo.SerialNumber + Environment.NewLine);// device[i].GetPosition(ch1).ToString("F4")

                ch1 = InertialMotorStatus.MotorChannels.Channel1;
                ch2 = InertialMotorStatus.MotorChannels.Channel2;

                //Set step rate and acceleration

                currentDeviceSettings.Drive.Channel(ch1).StepRate         = 1000;
                currentDeviceSettings.Drive.Channel(ch1).StepAcceleration = 100000;
                currentDeviceSettings.Drive.Channel(ch2).StepRate         = 1000;
                currentDeviceSettings.Drive.Channel(ch2).StepAcceleration = 100000;


                //apply setting

                deviceTIM.SetSettings(currentDeviceSettings, true, true);

                //get motor positions and print

                motorX = deviceTIM.GetPosition(ch1);//GetPosition(ch1);
                motorY = deviceTIM.GetPosition(ch2);
            }
            else
            {
                //TDC



                KpxUD.Value      = (decimal)Properties.Settings.Default.Kpx2;
                KixUD.Value      = (decimal)Properties.Settings.Default.Kix2;
                KdxUD.Value      = (decimal)Properties.Settings.Default.Kdx2;
                KpyUD.Value      = (decimal)Properties.Settings.Default.Kpy2;
                KiyUD.Value      = (decimal)Properties.Settings.Default.Kiy2;
                KdyUD.Value      = (decimal)Properties.Settings.Default.Kdy2;
                minMoveXUD.Value = (decimal)Properties.Settings.Default.minMoveX2;
                minMoveYUD.Value = (decimal)Properties.Settings.Default.minMoveY2;

                imaxxUD.Value = (decimal)Properties.Settings.Default.imaxX2;
                imaxyUD.Value = (decimal)Properties.Settings.Default.imaxY2;

                reverseX.Checked = Properties.Settings.Default.revx2;
                reverseY.Checked = Properties.Settings.Default.revy2;

                stepUpDown.DecimalPlaces = 2;
                stepUpDown.Increment     = (decimal)0.05;

                for (int i = 0; i < serialNumbersTDC.Count(); i++)
                {
                    devicesTDC[i] = TCubeDCServo.CreateTCubeDCServo(serialNumbersTDC[i]);

                    richTextBox1.AppendText(i + " Serial: " + serialNumbersTDC[i]);

                    try {
                        devicesTDC[i].Connect(serialNumbersTDC[i]);

                        if (!devicesTDC[i].IsSettingsInitialized())
                        {
                            devicesTDC[i].WaitForSettingsInitialized(5000);
                        }

                        devicesTDC[i].StartPolling(100);

                        MotorConfiguration motorSettings = devicesTDC[i].GetMotorConfiguration(serialNumbersTDC[i], DeviceConfiguration.DeviceSettingsUseOptionType.UseDeviceSettings); //serialNumbersTDC[i]

                        DCMotorSettings currentDeviceSettings = devicesTDC[i].MotorDeviceSettings as DCMotorSettings;

                        // display info about device
                        DeviceInfo deviceInfo = devicesTDC[i].GetDeviceInfo();
                        richTextBox1.AppendText(i + " Device  " + deviceInfo.Name + " " + deviceInfo.SerialNumber + " " + devicesTDC[i].GetMoveAbsolutePosition().ToString("F4") + Environment.NewLine);
                    } catch (Exception ex) {
                        richTextBox1.AppendText(" " + ex.Message + Environment.NewLine);
                    }
                }
            }



            motorXlbl.Text = "X: " + motorX.ToString();
            motorYlbl.Text = "Y: " + motorY.ToString();



            if (TIM)
            {
                //get status of ch1

                //InertialMotorStatus status = deviceTIM.ChannelStatus(ch1);
                // richTextBox1.AppendText(status.Status + " " + status.Position + " " + status.IsError + " " + status.IsMoving + Environment.NewLine);// device[i].GetPosition(ch1).ToString("F4")
            }
            else
            {
            }


            //Create MaxIm DL object

            ccd = new MaxIm.CCDCamera();

            // ccd.Notify += notify();

            //Connect CCD

            ccd.LinkEnabled = true;

            /*
             * ccd.MultiStarGuiding = true;
             *
             * ccd.GuiderExpose(1.0);
             *
             * while (ccd.GuiderRunning) {
             *  Thread.Sleep(100);
             * }
             *
             * ccd.GuiderTrack(1.0);
             */

            //Thread.Sleep(2000);

            //Notify on new guider image(?)

            ccd.EventMask = 256;

            ccd.Notify += new MaxIm._CameraEvents_NotifyEventHandler(notify);

            //Sets minimum correction interval

            timer1.Interval = Convert.ToInt16(correctionUpDown.Value * 1000);
            timer1.Enabled  = true;

            ready = true;
        }
Exemplo n.º 15
0
        public Main()
        {
            InitializeComponent();

            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }

            derrX[0] = 0; derrX[1] = 0; derrX[2] = 0; derrY[0] = 0; derrY[1] = 0; derrY[2] = 0;


            stopWatch.Start();


            KpxUD.Value      = (decimal)Properties.Settings.Default.Kpx2;
            KixUD.Value      = (decimal)Properties.Settings.Default.Kix2;
            KdxUD.Value      = (decimal)Properties.Settings.Default.Kdx2;
            KpyUD.Value      = (decimal)Properties.Settings.Default.Kpy2;
            KiyUD.Value      = (decimal)Properties.Settings.Default.Kiy2;
            KdyUD.Value      = (decimal)Properties.Settings.Default.Kdy2;
            minMoveXUD.Value = (decimal)Properties.Settings.Default.minMoveX2;
            minMoveYUD.Value = (decimal)Properties.Settings.Default.minMoveY2;

            imaxxUD.Value = (decimal)Properties.Settings.Default.imaxX2;
            imaxyUD.Value = (decimal)Properties.Settings.Default.imaxY2;

            reverseX.Checked = Properties.Settings.Default.revx2;
            reverseY.Checked = Properties.Settings.Default.revy2;

            stepUpDown.DecimalPlaces = 2;
            stepUpDown.Increment     = (decimal)0.05;


            motorXlbl.Text = "X: " + motorX.ToString();
            motorYlbl.Text = "Y: " + motorY.ToString();


            //Create MaxIm DL object

            ccd = new MaxIm.CCDCamera();

            // ccd.Notify += notify();

            //Connect CCD

            ccd.LinkEnabled = true;

            /*
             * ccd.MultiStarGuiding = true;
             *
             * ccd.GuiderExpose(1.0);
             *
             * while (ccd.GuiderRunning) {
             *  Thread.Sleep(100);
             * }
             *
             * ccd.GuiderTrack(1.0);
             */

            //Thread.Sleep(2000);

            //Notify on new guider image(?)

            ccd.EventMask = 256;

            ccd.Notify += new MaxIm._CameraEvents_NotifyEventHandler(notify);

            //Sets minimum correction interval

            timer1.Interval = Convert.ToInt16(correctionUpDown.Value * 1000);
            timer1.Enabled  = true;

            ready = true;
        }