private void AutoGuideOnButton_Click(object sender, EventArgs e) { //Execute TSX_AutoGuide class // Open and connect to autoguider // if (not calibrated,) { abort // Find guidestar // Turn on Autoguide SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); if (NHUtil.IsButtonRed(AutoGuideOnButton)) { AutoGuide.AutoGuideStop(); AutoGuideOnButton.Text = "Start\r\nAutoguiding"; NHUtil.ButtonGreen(AutoGuideOnButton); } else { //First, save the guider cycle time and anything else in the future that might be hanging around tPlan.GuiderCycleTime = (double)GuiderCycleTimeNum.Value; if (tPlan.DitherEnabled) { AutoGuide.DitherAndStart(); } else { AutoGuide.AutoGuideStart(); } AutoGuideOnButton.Text = "Stop\r\nAutoguiding"; NHUtil.ButtonRed(AutoGuideOnButton); } }
private void ToTSXButton_Click(object sender, EventArgs e) { //Tries to look up the name in the target box. If found, then a new target plan is //opened. Disconnect the telescope (in case centering is forced), use the target box to find //and and center the star chart and FOV on the target. //If not throw a log entry and return; //Remove spaces from target name if any //PlanTargetBox.Text = PlanTargetBox.Text.Replace(" ", ""); LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); NHUtil.ButtonRed(SelectButton); TSXLink.Target tgt = TSXLink.StarChart.FindTarget(PlanTargetBox.Text); if (tgt != null) { TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Mount); TargetPlan newtPlan = new TargetPlan(tgt.Name); newtPlan.TargetPA = TSXLink.FOVI.GetFOVPA; newtPlan.TargetAdjustEnabled = false; PlanTargetBox.Text = newtPlan.TargetName; TSXLink.StarChart.SetFOV(2); LoadTargetPlanList(); openSession.CurrentTargetName = newtPlan.TargetName; lg.LogIt("A new target plan has been created for " + newtPlan.TargetName); } else { lg.LogIt(PlanTargetBox.Text + ": target not found."); } NHUtil.ButtonGreen(SelectButton); Show(); }
private void FindStarButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(FindStarButton); SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); bool fsbresult = AutoGuide.SetAutoGuideStar(); //if there is an error, then assume that the exposure is just too low // reset the guide exposure to maximum and try again if (!fsbresult) { tPlan.GuideExposure = tPlan.MaximumGuiderExposure; GuideExposureTimeBox.Value = (decimal)tPlan.MaximumGuiderExposure; fsbresult = AutoGuide.SetAutoGuideStar(); } //If it worked this time then update the guide star position, otherwise just leave it if (fsbresult) { GuideStarXBox.Text = Convert.ToInt32(tPlan.GuideStarX).ToString(); GuideStarYBox.Text = Convert.ToInt32(tPlan.GuideStarY).ToString(); } NHUtil.ButtonGreen(FindStarButton); }
private void CalibrateButton_Click(object sender, EventArgs e) { //Calibrate the mount (direct guide), then calibrate AO, if set NHUtil.ButtonRed(CalibrateButton); AutoGuide.CalibrateAutoguiding(SubframeCheckBox.Checked, (double)XAxisMoveTime.Value, (double)YAxisMoveTime.Value); //Restore original target position if (a new star was used NHUtil.ButtonGreen(CalibrateButton); }
private void ConnectButton_Click(object sender, EventArgs e) { if (NHUtil.IsButtonGreen(ConnectButton)) { NHUtil.ButtonRed(ConnectButton); Operations.InitializeSystem(); NHUtil.ButtonGreen(ConnectButton); } }
private void FlatManStageButton_Click(object sender, EventArgs e) { FlatMan flmn = new FlatMan(); NHUtil.ButtonRed(FlatManStageButton); flmn.FlatManStage(); NHUtil.ButtonGreen(FlatManStageButton); return; }
private void AbortButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(AbortButton); //AbortEvent ab = new AbortEvent(); SetAbort(); //ab.AbortIt("Abort Button Clicked"); NHUtil.ButtonGreen(AbortButton); StartButton.Text = "Aborted"; NHUtil.ButtonRed(StartButton); }
private void SaveDefaultButton_Click(object sender, EventArgs e) { //Saves the current active target file as the default file SessionControl openSession = new SessionControl(); NHUtil.ButtonRed(SaveDefaultButton); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); tPlan.SavePlanAsDefaultPlan(); NHUtil.ButtonGreen(SaveDefaultButton); }
private void TakeFlatsButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(TakeFlatsButton); SessionControl openSession = new SessionControl(); FlatManager fmgr = new FlatManager(); fmgr.TakeFlats(); FlatManBrightnessNum.Value = openSession.FlatManBrightness; NHUtil.ButtonGreen(TakeFlatsButton); return; }
private void OptimizeExposureButton_Click(object sender, EventArgs e) { SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); NHUtil.ButtonRed(OptimizeExposureButton); double optExposure = AutoGuide.OptimizeExposure(); GuideExposureTimeBox.Value = (decimal)optExposure; tPlan.GuideExposure = optExposure; NHUtil.ButtonGreen(OptimizeExposureButton); }
private void Presetbutton_Click(object sender, EventArgs e) { //Moves focuser to critical focus position for current temperature based on "Current.foc" focus training file: // Checks for focuser connection // Gets current temperature from focuser // Calls function to compute new position from a selected focus training data file and current temperature // Moves focuser to new position from current position NHUtil.ButtonRed(Presetbutton); LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); //Get a filter focus file path from the configuration file, then validate/change via dialog FilterFileDialog.InitialDirectory = openSession.FocuserDataFolder; FilterFileDialog.FileName = ""; DialogResult focusfilelist = FilterFileDialog.ShowDialog(); //Check for a null return (e.g. no file selected) // just log it and return if nothing there if (focusfilelist != DialogResult.OK) { lg.LogIt("No focus preset file selected"); NHUtil.ButtonGreen(Presetbutton); return; } //Else... string focusfile = FilterFileDialog.FileNames[0]; //Save the new (or unchanged) file path int baseFilterId = tPlan.FocusFilter; lg.LogIt("Presetting focus position"); double currenttemp = TSXLink.Focus.GetTemperature(); double newfocusposition = AutoFocus.ComputeNewFocusPosition(focusfile, currenttemp, baseFilterId); if (newfocusposition == 0) { //Insufficient data to compute new position so, just leave it. lg.LogIt("Focus preset aborted -- insufficient data to compute new position"); NHUtil.ButtonGreen(Presetbutton); return; } else { TSXLink.Focus.MoveTo(newfocusposition); } lg.LogIt("Focus preset completed"); NHUtil.ButtonGreen(Presetbutton); return; }
private void LoadPlanButton_Click(object sender, EventArgs e) { //Sets the active plan to the plan selected in the target list box NHUtil.ButtonRed(LoadPlanButton); if (!(PlanListBox.SelectedItem == null)) { string tname = PlanListBox.SelectedItem.ToString(); LoadNewTargetPlan(tname); } LoadTargetPlanList(); NHUtil.ButtonGreen(LoadPlanButton); }
private void MosaicButton_Click(object sender, EventArgs e) { //Reads and constructs mosaic entry as a set of target plans after a mosaic has // been constructed and copied to the clipboard in TSX // // Button will be held red until the user has prepared mosaic in TSX and // copied to clipboard SessionControl openSession = new SessionControl(); if (NHUtil.IsButtonGreen(MosaicButton)) { //Verify that a target has been loaded, if not, post error and return // otherwise, set the button color to read, change the text and zero the FOVI // in anticipation of loading a mosaic target set TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); if (TSXLink.StarChart.IsValidTarget(tPlan)) { NHUtil.ButtonRed(MosaicButton); MosaicButton.Text = "Clipboard Ready"; TSXLink.FOVI.SetFOVPA(0); } } else { Mosaic nhms = new Mosaic(); List <Mosaic.MosaicTarget> nhmtgts = nhms.ReadTSXMosaic(); //Just return if no targets are found if (nhmtgts != null) { //Save the mosaic entries as versions of the current configuration file // For each of the entries in the mosaic, // Load the values into the configuration file // Save the configuration file with a prefix tName-Set-Frame string tName = openSession.CurrentTargetName; foreach (Mosaic.MosaicTarget mt in nhmtgts) { string prefixName = tName + "-" + mt.Set + "-" + mt.Frame; TargetPlan tPlan = new TargetPlan(prefixName) { TargetName = prefixName, TargetRA = mt.RA, TargetDec = mt.Dec, TargetPA = mt.PositionAngle, TargetAdjustEnabled = true }; } } LoadTargetPlanList(); MosaicButton.Text = "Build Mosaic"; NHUtil.ButtonGreen(MosaicButton); } }
private void RotateToRPAButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(RotateToRPAButton); Rotator.PlateSolveIt(); DisplayResults(); double rotate = (double)MoveToRPANum.Value; Rotator.RotateToRotatorPA(rotate); Rotator.PlateSolveIt(); DisplayResults(); NHUtil.ButtonGreen(RotateToRPAButton); return; }
private void RotateToIPAButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(RotateToIPAButton); DisplayResults(); double rotate = (double)MoveToIPANum.Value; if (Rotator.RotateToImagePA(rotate)) { DisplayResults(); } NHUtil.ButtonGreen(RotateToIPAButton); return; }
private void InitializeButton_Click(object sender, EventArgs e) { //Get location and PA of FOV on chart NHUtil.ButtonRed(InitializeButton); LogEvent lg = new LogEvent(); DisplayResults(); Show(); Rotator.CalibrateRotator(); DisplayResults(); Show(); NHUtil.ButtonGreen(InitializeButton); return; }
private void FromTSXButton_Click(object sender, EventArgs e) { /* Method gets whatever target is showing in the find function in TSX * normally by using a click on a star chart object. If no object has been * choosen (Mouse click position) or simply no target (null) then return * Otherwise, clear the spaces out of the name and check for characters (like ":") * that won't work in a file name. If illegal characters, then return * Otherwise, find an existing or open new target plan for this target name * and make it the target plan for the current session */ LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); //get the current target name from TSX and save it. NHUtil.ButtonRed(AcquireButton); //Retrieve current target from TSX TSXLink.Target tgt = TSXLink.StarChart.FindTarget(); //Check to see if we're looking at a "Mouse Click Postion" // if so, just get out of this if ((tgt.Name != "Mouse click position") && (tgt != null)) { //Remove spaces from target name if any tgt.Name = tgt.Name.Replace(" ", ""); //Remove known "illegal" characters if (tgt.Name.Contains(":")) { lg.LogIt("Unsupported filename characters in target name " + tgt.Name); MessageBox.Show("Unsupported characters in target name : " + tgt.Name); } else { TargetPlan newtPlan = new TargetPlan(tgt.Name) { TargetAdjustEnabled = false, TargetRA = tgt.RA, TargetDec = tgt.Dec }; newtPlan.TargetPA = TSXLink.FOVI.GetFOVPA; PlanTargetBox.Text = newtPlan.TargetName; TSXLink.StarChart.SetFOV(2); LoadTargetPlanList(); openSession.CurrentTargetName = newtPlan.TargetName; lg.LogIt("A new target plan has been created for " + newtPlan.TargetName); } } NHUtil.ButtonGreen(AcquireButton); this.Show(); }
private void AtFocus2Button_Click(object sender, EventArgs e) { //Execute TSX_AutoFocus class // Save current object information // Open and connect Autofocus // Run Focus@2 for all five filters // Save datepoints // Turn on temperature compensation // Return telescope to object with CloseLoopSlew NHUtil.ButtonRed(AtFocus2Button); AutoFocus.FocusIt(2); NHUtil.ButtonGreen(AtFocus2Button); return; }
private void DisconnectButton_Click(object sender, EventArgs e) { LogEvent lg = new LogEvent(); NHUtil.ButtonRed(DisconnectButton); lg.LogIt("Disconnecting"); if (ParkMountCheckBox.Checked) { lg.LogIt("Parking mount"); TSXLink.Connection.SecureMount(); ParkMountCheckBox.Checked = false; } TSXLink.Connection.DisconnectAllDevices(); NHUtil.ButtonGreen(DisconnectButton); return; }
private void ImageForecastButton_Click(object sender, EventArgs e) { //Launches ImageForecast to create target plans NHUtil.ButtonRed(ImageForecastButton); string toolName = "Image Planner.appref-ms"; string ttdir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Windows\\Start Menu\\Programs\\TSXToolkit\\TSXToolkit"; Process pSystemExe = new Process(); string ifbPath = ttdir + "\\" + toolName; pSystemExe.StartInfo.FileName = ifbPath; if (System.IO.File.Exists(ifbPath)) { pSystemExe.Start(); } NHUtil.ButtonGreen(ImageForecastButton); }
private void PlateSolveButton_Click(object sender, EventArgs e) { //Run a plate solve (image link) to determine the current rotator PA //Connect to camera. //Set autosave. //Take an image NHUtil.ButtonRed(PlateSolveButton); LogEvent lg = new LogEvent(); if (!Rotator.PlateSolveIt()) { NHUtil.ButtonGreen(PlateSolveButton); return; } DisplayResults(); NHUtil.ButtonGreen(PlateSolveButton); return; }
private void TargetButton_Click(object sender, EventArgs e) { //POint telescope at target RA/Dec and rotate to PA //Slew scope to RA,Dec NHUtil.ButtonRed(TargetButton); SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); TSXLink.StarChart.ChartRA = tPlan.TargetRA; TSXLink.StarChart.ChartDec = tPlan.TargetDec; DisplayResults(); if (Rotator.RotateToImagePA(tPlan.TargetPA)) { DisplayResults(); } NHUtil.ButtonGreen(TargetButton); return; }
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; } }
private void StartButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(StartButton); StartButton.Text = "Running"; SetRunning(); //One can minimize TSX to help with performance, but don't //ManageTSX.MinimizeTSX(); //Set the form to display the target tab HumasonTabs.SelectedIndex = 1; SessionState = SessionStateFlag.Running; //Light off the overall imaging control process bool successReport = Operations.ImagingControl(); //All done //Clear the Running and Abort buttons StartButton.Text = "Start"; NHUtil.ButtonGreen(StartButton); AbortButton.Text = "Stop"; NHUtil.ButtonGreen(AbortButton); }
private void AdjustButton_Click(object sender, EventArgs e) { //Adjust button depends on prior state: // if button green, then an adjustment of RA/Dec/PA is to be run // Reset the tPlan name to the orginal name, // and save tPlan RA/Dec/PA with those StarChart values (via TSXFind) // wait until button is pushed again, essentially // if button red, then an adjustment has been completed. // Get the current StarChart values from TSX // and saves tPlan RA/Dec/PA with those StarChart values. SessionControl openSession = new SessionControl(); if (NHUtil.IsButtonGreen(AdjustButton)) { NHUtil.ButtonRed(AdjustButton); this.AdjustButton.Text = "Save Adjustment"; TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); TSXLink.Target tgt = TSXLink.StarChart.FindTarget(tPlan.TargetName); double totalPA = AstroMath.Transform.NormalizeDegreeRange(Rotator.RealRotatorPA + TSXLink.FOVI.GetFOVPA); tPlan.TargetRA = tgt.RA; tPlan.TargetDec = tgt.Dec; tPlan.TargetPA = totalPA; tPlan.TargetAdjustEnabled = false; TSXLink.StarChart.SetFOV(2.0); } else { TSXLink tLink = new TSXLink(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); double totalPA = AstroMath.Transform.NormalizeDegreeRange(Rotator.RealRotatorPA + TSXLink.FOVI.GetFOVPA); tPlan.TargetRA = TSXLink.StarChart.ChartRA; tPlan.TargetDec = TSXLink.StarChart.ChartDec; tPlan.TargetPA = totalPA; tPlan.TargetAdjustEnabled = true; UpdateHumasonSequencer(); NHUtil.ButtonGreen(AdjustButton); this.AdjustButton.Text = "Adjust Target"; } }
private void RefreshFiltersButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(RefreshFiltersButton); RefreshFilterList(); NHUtil.ButtonGreen(RefreshFiltersButton); }
private void GuiderAutoCalibrateButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(GuiderAutoCalibrateButton); AtGuider2.AtGuider2.CalibrateGuider(); NHUtil.ButtonGreen(GuiderAutoCalibrateButton); }
public void UpdateButton_Click(object sender, EventArgs e) { NHUtil.ButtonRed(UpdateButton); TabUpdate(); NHUtil.ButtonGreen(UpdateButton); }