18 #include <KMessageBox>
25 #define DRIFT_GRAPH_WIDTH 300
26 #define DRIFT_GRAPH_HEIGHT 300
41 ui.comboBox_SquareSize->clear();
43 ui.comboBox_SquareSize->addItem( QString().setNum(
guide_squares[i].size ) );
45 ui.comboBox_ThresholdAlg->clear();
53 connect( ui.spinBox_XScale, SIGNAL(valueChanged(
int)),
this, SLOT(
onXscaleChanged(
int)) );
54 connect( ui.spinBox_YScale, SIGNAL(valueChanged(
int)),
this, SLOT(
onYscaleChanged(
int)) );
55 connect( ui.comboBox_SquareSize, SIGNAL(activated(
int)),
this, SLOT(
onSquareSizeChanged(
int)) );
56 connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(
int)),
this, SLOT(
onThresholdChanged(
int)) );
57 connect( ui.spinBox_GuideRate, SIGNAL(valueChanged(
double)),
this, SLOT(
onInfoRateChanged(
double)) );
58 connect( ui.checkBox_DirRA, SIGNAL(stateChanged(
int)),
this, SLOT(
onEnableDirRA(
int)) );
59 connect( ui.checkBox_DirDEC, SIGNAL(stateChanged(
int)),
this, SLOT(
onEnableDirDEC(
int)) );
60 connect( ui.spinBox_AccFramesRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
61 connect( ui.spinBox_AccFramesDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
62 connect( ui.spinBox_PropGainRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
63 connect( ui.spinBox_PropGainDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
64 connect( ui.spinBox_IntGainRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
65 connect( ui.spinBox_IntGainDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
66 connect( ui.spinBox_DerGainRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
67 connect( ui.spinBox_DerGainDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
68 connect( ui.spinBox_MaxPulseRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
69 connect( ui.spinBox_MaxPulseDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
70 connect( ui.spinBox_MinPulseRA, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
71 connect( ui.spinBox_MinPulseDEC, SIGNAL(editingFinished()),
this, SLOT(
onInputParamChanged()) );
73 connect(ui.captureB, SIGNAL(clicked()), pmain_wnd, SLOT(capture()));
81 pDriftOut->move( ui.frame_Graph->frameWidth(), ui.frame_Graph->frameWidth() );
82 pDriftOut->setAttribute( Qt::WA_NoSystemBackground,
true );
83 ui.frame_Graph->setAttribute( Qt::WA_NoSystemBackground,
true );
96 half_refresh_rate =
false;
111 half_refresh_rate = is_half;
144 ui.spinBox_XScale->setValue( rx / drift_graph->
get_grid_N() );
145 ui.spinBox_YScale->setValue( ry / drift_graph->
get_grid_N() );
154 ui.spinBox_GuideRate->setValue( in_params->
guiding_rate );
157 ui.l_Focal->setText( str.setNum( (
int)info_params.
focal) );
158 ui.l_Aperture->setText( str.setNum( (
int)info_params.
aperture) );
159 ui.l_FbyD->setText( QString().setNum( info_params.
focal_ratio,
'f', 1) );
160 str = QString().setNum(info_params.
fov_wd,
'f', 1) +
'x' + QString().setNum(info_params.
fov_ht,
'f', 1);
161 ui.l_FOV->setText( str );
172 ui.spinBox_IntGainRA->setValue( in_params->
integral_gain[GUIDE_RA] );
173 ui.spinBox_IntGainDEC->setValue( in_params->
integral_gain[GUIDE_DEC] );
175 ui.spinBox_DerGainRA->setValue( in_params->
derivative_gain[GUIDE_RA] );
176 ui.spinBox_DerGainDEC->setValue( in_params->
derivative_gain[GUIDE_DEC] );
185 ui.l_DeltaRA->setText(QString().setNum(out_params->
delta[GUIDE_RA],
'f', 2) );
186 ui.l_DeltaDEC->setText(QString().setNum(out_params->
delta[GUIDE_DEC],
'f', 2) );
188 ui.l_PulseRA->setText(QString().setNum(out_params->
pulse_length[GUIDE_RA]) );
189 ui.l_PulseDEC->setText(QString().setNum(out_params->
pulse_length[GUIDE_DEC]) );
191 ui.l_ErrRA->setText( QString().setNum(out_params->
sigma[GUIDE_RA]) );
192 ui.l_ErrDEC->setText( QString().setNum(out_params->
sigma[GUIDE_DEC]) );
290 QDoubleSpinBox *pDSB;
301 if( (pSB = dynamic_cast<QSpinBox *>(obj)) )
303 if( pSB == ui.spinBox_AccFramesRA )
306 if( pSB == ui.spinBox_AccFramesDEC )
309 if( pSB == ui.spinBox_MaxPulseRA )
312 if( pSB == ui.spinBox_MaxPulseDEC )
315 if( pSB == ui.spinBox_MinPulseRA )
318 if( pSB == ui.spinBox_MinPulseDEC )
322 if( (pDSB = dynamic_cast<QDoubleSpinBox *>(obj)) )
324 if( pDSB == ui.spinBox_PropGainRA )
327 if( pDSB == ui.spinBox_PropGainDEC )
330 if( pDSB == ui.spinBox_IntGainRA )
333 if( pDSB == ui.spinBox_IntGainDEC )
336 if( pDSB == ui.spinBox_DerGainRA )
339 if( pDSB == ui.spinBox_DerGainDEC )
361 ui.pushButton_StartStop->setText( i18n(
"Stop") );
373 ui.pushButton_StartStop->setText( i18n(
"Start Autoguide") );
392 double drift_x = 0, drift_y = 0;
406 KMessageBox::error(NULL, i18n(
"Lost track of the guide star. Try increasing the square size and check the mount."));
423 drift_graph->
add_point( drift_x, drift_y );
431 ui.l_DeltaRA->setText(str.setNum(out->
delta[
GUIDE_RA],
'f', 2) );
432 ui.l_DeltaDEC->setText(str.setNum(out->
delta[
GUIDE_DEC],
'f', 2) );
437 ui.l_ErrRA->setText( str.setNum(out->
sigma[
GUIDE_RA],
'g', 3));
438 ui.l_ErrDEC->setText( str.setNum(out->
sigma[
GUIDE_DEC],
'g', 3 ));
442 if( half_refresh_rate && (tick & 1) )
454 if (is_ready && pimage && is_started ==
false)
463 pmath->
move_square(x-square_size/2, y-square_size/2);
void set_math(cgmath *math)
void appendLogText(const QString &)
double derivative_gain[CHANNEL_CNT]
double integral_gain[CHANNEL_CNT]
#define DRIFT_GRAPH_HEIGHT
void onYscaleChanged(int i)
const cproc_out_params * get_out_params(void) const
void get_star_drift(double *dx, double *dy) const
const square_alg_t guide_square_alg[]
uint32_t get_ticks(void) const
cproc_in_params * get_in_params(void)
void onStartStopButtonClick()
int get_square_algorithm_index(void) const
int min_pulse_length[CHANNEL_CNT]
void onEnableDirRA(int state)
int max_pulse_length[CHANNEL_CNT]
uint32_t accum_frame_cnt[CHANNEL_CNT]
void guideStarSelected(int x, int y)
bool is_lost_star(void) const
GuideDirection pulse_dir[2]
void onXscaleChanged(int i)
#define DRIFT_GRAPH_WIDTH
info_params_t get_info_params(void) const
void resize_square(int size_idx)
void set_image(FITSView *image)
bool set_source(QImage *image, mouse_delegate *mouse)
void move_square(double newx, double newy)
bool do_pulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs)
void set_half_refresh_rate(bool is_half)
void onInputParamChanged()
static double precalc_proportional_gain(double g_rate)
void onSquareSizeChanged(int index)
void onInfoRateChanged(double val)
bool is_guiding(void) const
bool set_reticle_params(double x, double y, double ang)
int get_square_index(void) const
void onEnableDirDEC(int state)
bool enabled[CHANNEL_CNT]
void fill_interface(void)
rguider(Ekos::Guide *parent=0)
void set_square_algorithm(int alg_idx)
const guide_square_t guide_squares[]
double proportional_gain[CHANNEL_CNT]
void onThresholdChanged(int i)