Beispiel #1
0
        private void FlatManStageButton_Click(object sender, EventArgs e)
        {
            FlatMan flmn = new FlatMan();

            NHUtil.ButtonRed(FlatManStageButton);
            flmn.FlatManStage();
            NHUtil.ButtonGreen(FlatManStageButton);
            return;
        }
Beispiel #2
0
        private void FlatManOnButton_Click(object sender, EventArgs e)
        {
            SessionControl openSession = new SessionControl();
            SessionControl tplan       = openSession;

            if (NHUtil.IsButtonGreen(FlatManOnButton))
            {
                FlatMan flmn = new FlatMan();
                NHUtil.ButtonRed(FlatManOnButton);
                FlatManOnButton.Text = "Turn Off";
                flmn.Light           = true;
            }
            else
            {
                NHUtil.ButtonGreen(FlatManOnButton);
                FlatManOnButton.Text = "Turn On";
                FlatMan flmn = new FlatMan();
                flmn.Light = false;
            }
        }
Beispiel #3
0
        public FormFlats()
        {
            InitializeComponent();

            SessionControl openSession = new SessionControl();
            FlatMan        flmn        = new FlatMan();

            if (openSession.FlatsTargetADU != 0)
            {
                FlatsTargetADU.Value = openSession.FlatsTargetADU;
            }
            else
            {
                openSession.FlatsTargetADU = (int)FlatsTargetADU.Value;
            }
            if (openSession.FlatsRepetitions != 0)
            {
                FlatsRepetitionsBox.Value = openSession.FlatsRepetitions;
            }
            else
            {
                openSession.FlatsRepetitions = (int)FlatsRepetitionsBox.Value;
            }
            if (openSession.FlatManBrightness != 0)
            {
                FlatManBrightnessNum.Value = openSession.FlatManBrightness;
            }
            else
            {
                openSession.FlatManBrightness = (int)FlatManBrightnessNum.Value;
            }
            if (openSession.FlatsExposureTime != 0)
            {
                FlatManExposureNum.Value = (decimal)openSession.FlatsExposureTime;
            }
            else
            {
                openSession.FlatsExposureTime = (int)FlatManExposureNum.Value;
            }
            if (openSession.IsFlatFlipEnabled)
            {
                FlatFlipCheckBox.Checked = openSession.IsFlatFlipEnabled;
            }
            else
            {
                openSession.IsFlatFlipEnabled = FlatFlipCheckBox.Checked;
            }
            if (openSession.IsFlatManEast)
            {
                FlatManEastCheckBox.Checked = openSession.IsFlatManEast;
            }
            else
            {
                openSession.IsFlatManEast = FlatManEastCheckBox.Checked;
            }
            if (openSession.IsFlatsRotationEnabled)
            {
                FlatsRotationCheckBox.Checked = openSession.IsFlatsRotationEnabled;
            }
            else
            {
                openSession.IsFlatsRotationEnabled = FlatsRotationCheckBox.Checked;
            }
            if (openSession.IsFlatManManualSetupEnabled)
            {
                FlatManManualSetupCheckbox.Checked = openSession.IsFlatManManualSetupEnabled;
            }
            else
            {
                openSession.IsFlatManManualSetupEnabled = FlatManManualSetupCheckbox.Checked;
            }

            FlatManager.LightSource flatLightSource = openSession.FlatLightSource;
            // FlatManager.LightSource flatLightSource = (FlatManager.LightSource)Enum.Parse(typeof(FlatManager.LightSource), sflatLightSource);
            switch (flatLightSource)
            {
            case (FlatManager.LightSource.lsNone): { FlatManRadioButton.Checked = false; break; }

            case (FlatManager.LightSource.lsFlatMan): { FlatManRadioButton.Checked = true; break; }

            case (FlatManager.LightSource.lsDawn): { DawnRadioButton.Checked = true; break; }

            case (FlatManager.LightSource.lsDusk): { DuskRadioButton.Checked = true; break; }

            default: { FlatManRadioButton.Checked = false; break; }
            }

            FlatManPortNum.Value = openSession.FlatManComPort;

            //If FlatMan has been chosen for flats, make sure the panel is turned off
            if (openSession.IsFlatManEnabled)
            {
                flmn.Light = false;
            }

            //Paint buttons green
            NHUtil.ButtonGreen(TakeFlatsButton);
            NHUtil.ButtonGreen(FlatManOnButton);
            NHUtil.ButtonGreen(FlatManStageButton);
            NHUtil.ButtonGreen(MakeFlatsButton);
            NHUtil.ButtonGreen(ClearFlatsButton);
            return;
        }
Beispiel #4
0
        public void TakeFlats()
        {
            //Pulls flat requests from the flat stack (file) and services accordingly
            LogEvent       lg          = new LogEvent();
            SessionControl openSession = new SessionControl();

            lg.LogIt("Checking for flat requests");

            //Opt out if no flats to look at
            if (!HaveFlatsToDo())
            {
                lg.LogIt("No flats to do");
                return;
            }
            else
            {
                lg.LogIt("Have flats do: Starting Flats");
            }

            //Fire off flatman if enabled, otherwise point the telescope up for dawn or dusk flats
            // Sort flats by filter and source (i.e. twightlight or dawn)
            if (openSession.IsFlatManEnabled)
            {
                //Stage the mount to the flatman
                FlatMan flmn = new FlatMan();
                lg.LogIt("Staging FlatMan");
                bool stgResult = flmn.FlatManStage();
                if (!stgResult)
                {
                    lg.LogIt("FlatMan Staging Failed -- aborting flats");
                    return;
                }
                //If Manual Setup is selected, then pause for user to position the FlatMan for flats
                //  Disconnect imaging devices before attaching panel, then reconnect afterwards
                //    this keeps the SBIG driver from freaking out when the guider USB is hot swapped
                //    with the FlatMan USB (Build 182+)
                if (openSession.IsFlatManManualSetupEnabled)
                {
                    lg.LogIt("Pausing to attach FlatMan panel");
                    lg.LogIt("Disconnecting imaging devices");
                    TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Camera);
                    TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Guider);
                    TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Focuser);
                    TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Rotator);
                    MessageBox.Show("Attach the FlatMan, then press OK");
                    lg.LogIt("Connecting imaging devices");
                    TSXLink.Connection.ConnectDevice(TSXLink.Connection.Devices.Camera);
                    TSXLink.Connection.ConnectDevice(TSXLink.Connection.Devices.Guider);
                    TSXLink.Connection.ConnectDevice(TSXLink.Connection.Devices.Focuser);
                    TSXLink.Connection.ConnectDevice(TSXLink.Connection.Devices.Rotator);
                }
                //Turn on Flatman panel, if it hasn't been done already
                lg.LogIt("Lighting up FlatMan panel");
                flmn.Light = true;
            }
            else //Dusk or dawn flats
            {
                //Unpark mount, if parked, which it often is to do dusk flats
                TSXLink.Mount.UnPark();
                //point telescope essentially up
                lg.LogIt("Pointing telescope just west of zenith");
                TSXLink.Mount.SlewAzAlt(200.0, (60), "Flat Spot");
                //Turn tracking off
                TSXLink.Mount.TurnTrackingOff();
            }

            //Alright, all ready to go.
            //Loop on the flat entries in the flat stack file, if any
            while (HaveFlatsToDo())
            {
                switch (openSession.FlatLightSource)
                {
                case (LightSource.lsNone):
                {
                    break;
                }

                case (LightSource.lsFlatMan):
                {
                    if (openSession.IsFlatManEnabled)
                    {
                        // **********************  Use Flatman
                        //Rotate to PA, if there is a rotator is enabled
                        Flat iFlat = GetLeastRotatedFlat();
                        if (openSession.IsRotationEnabled)
                        {
                            Rotator.RotateToRotatorPA(iFlat.RotationPA);
                        }
                        Imaging nhi = new Imaging();
                        nhi.DoFlatManFlats(iFlat.TargetName, iFlat.RotationPA, iFlat.SideOfPier, iFlat.FlatFilter);
                        RemoveFlat(iFlat);          //remove flat from flat stack file
                    }
                    break;
                }

                case (LightSource.lsDusk):
                {
                    //  ********************  Use Dusk
                    Flat    iFlat = GetLowestIndexFlat();
                    Imaging nhi   = new Imaging();
                    nhi.DoTwilightFlats(iFlat, true);
                    RemoveFlat(iFlat);          //remove flat from flat stack file
                    break;
                }

                case (LightSource.lsDawn):
                {
                    //  ********************  Use Dawn
                    Flat    iFlat = GetHighestIndexFlat();
                    Imaging nhi   = new Imaging();
                    nhi.DoTwilightFlats(iFlat, false);
                    RemoveFlat(iFlat);          //remove flat from flat stack file
                    break;
                }

                default: break;
                }
            }
            //If FlatMan was used, then shut it down
            if (openSession.IsFlatManEnabled)
            {
                //Turn off flatman functions
                FlatMan flmn = new FlatMan();
                lg.LogIt("Terminating FlatMan");
                //Turn on Flatman panel, if it hasn't been done already
                lg.LogIt("Turning off FlatMan panel");
                flmn.Light = false;
                //If Manual Setup is selected, then pause for user to position the FlatMan for flats
                if (openSession.IsFlatManManualSetupEnabled)
                {
                    lg.LogIt("Pausing to detach FlatMan panel");
                    MessageBox.Show("Detach the FlatMan, then press OK");
                }
            }

            //Turn tracking on
            TSXLink.Mount.TurnTrackingOn();
            //Park the mount
            TSXLink.Mount.Park();
            return;
        }