public void PulseGuide(GuideDirections Direction, int Duration) { if (wisetele.ShuttingDown) { throw new InvalidOperationException("Wise40 is shutting down"); } wisetele.PulseGuide(Direction, Duration); }
private void buttonGo_Click(object sender, EventArgs e) { labelRaDeltaDeg.Text = labelDecDeltaDeg.Text = labelRaDeltaEnc.Text = labelDecDeltaEnc.Text = string.Empty; move[TelescopeAxes.axisPrimary].moving = move[TelescopeAxes.axisSecondary].moving = false; if (radioButtonEast.Checked || radioButtonWest.Checked) { move[TelescopeAxes.axisPrimary].moving = true; move[TelescopeAxes.axisPrimary].millis = Convert.ToInt32(textBoxRaMillis.Text); move[TelescopeAxes.axisPrimary].coord_before = wisetele.RightAscension; move[TelescopeAxes.axisPrimary].enc_before = wisetele.HAEncoder.EncoderValue; move[TelescopeAxes.axisPrimary].dir = radioButtonWest.Checked ? GuideDirections.guideWest : GuideDirections.guideEast; } if (radioButtonNorth.Checked || radioButtonSouth.Checked) { move[TelescopeAxes.axisSecondary].moving = true; move[TelescopeAxes.axisSecondary].millis = Convert.ToInt32(textBoxDecMillis.Text); move[TelescopeAxes.axisSecondary].coord_before = wisetele.Declination; move[TelescopeAxes.axisSecondary].enc_before = wisetele.DecEncoder.EncoderValue; move[TelescopeAxes.axisSecondary].dir = radioButtonNorth.Checked ? GuideDirections.guideNorth : GuideDirections.guideSouth; } if (!move[TelescopeAxes.axisPrimary].moving && !move[TelescopeAxes.axisSecondary].moving) { return; } statuser.Show("Guiding ..."); if (move[TelescopeAxes.axisPrimary].moving) { try { wisetele.PulseGuide(move[TelescopeAxes.axisPrimary].dir, move[TelescopeAxes.axisPrimary].millis); } catch (Exception ex) { statuser.Show(ex.Message, 5000, Statuser.Severity.Error); } } if (move[TelescopeAxes.axisSecondary].moving) { try { wisetele.PulseGuide(move[TelescopeAxes.axisSecondary].dir, move[TelescopeAxes.axisSecondary].millis); } catch (Exception ex) { statuser.Show(ex.Message, 5000, Statuser.Severity.Error); } } while (wisetele.IsPulseGuiding) { Application.DoEvents(); } statuser.Show("Done.", 2000); if (move[TelescopeAxes.axisPrimary].moving) { move[TelescopeAxes.axisPrimary].coord_after = wisetele.RightAscension; move[TelescopeAxes.axisPrimary].enc_after = wisetele.HAEncoder.EncoderValue; labelRaDeltaDeg.Text = (new Angle(Math.Abs(move[TelescopeAxes.axisPrimary].coord_after - move[TelescopeAxes.axisPrimary].coord_before), Angle.Type.RA)).ToString(); labelRaDeltaEnc.Text = (Math.Abs(move[TelescopeAxes.axisPrimary].enc_after - move[TelescopeAxes.axisPrimary].enc_before)).ToString("F0"); } if (move[TelescopeAxes.axisSecondary].moving) { move[TelescopeAxes.axisSecondary].coord_after = wisetele.Declination; move[TelescopeAxes.axisSecondary].enc_after = wisetele.DecEncoder.EncoderValue; labelDecDeltaDeg.Text = (new Angle(Math.Abs(move[TelescopeAxes.axisSecondary].coord_after - move[TelescopeAxes.axisSecondary].coord_before), Angle.Type.Dec)).ToString(); labelDecDeltaEnc.Text = (Math.Abs(move[TelescopeAxes.axisSecondary].enc_after - move[TelescopeAxes.axisSecondary].enc_before)).ToString("F0"); } }