summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-27 10:48:09 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-27 10:48:09 (GMT)
commit642bbc648558124c9bd46b538dd1f9940acac9bb (patch)
treebd732fdfc34a824fdd54ed20a1c13dd4ebebd300
parent2d0c307a925fb374637996ffb26e33dc4d3f4240 (diff)
Working on implementing calibration and guiding options
-rw-r--r--kstars/CMakeLists.txt2
-rw-r--r--kstars/ekos/guide/guide.cpp16
-rw-r--r--kstars/ekos/guide/guide.h9
-rw-r--r--kstars/ekos/guide/guide.ui8
-rw-r--r--kstars/ekos/guide/guideinterface.cpp26
-rw-r--r--kstars/ekos/guide/guideinterface.h8
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp10
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.h4
-rw-r--r--kstars/ekos/guide/opscalibration.cpp71
-rw-r--r--kstars/ekos/guide/opscalibration.h53
-rw-r--r--kstars/ekos/opsekos.h4
11 files changed, 199 insertions, 12 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 646a0df..1f028e5 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -134,6 +134,7 @@ if (INDI_FOUND)
ekos/mount/mount.ui
# Guide
ekos/guide/guide.ui
+ ekos/guide/opscalibration.ui
#TODO remove from GIT
#ekos/guide/guider.ui
#ekos/guide/rcalibration.ui
@@ -178,6 +179,7 @@ if (INDI_FOUND)
ekos/guide/guide.cpp
ekos/guide/guideinterface.cpp
ekos/guide/scroll_graph.cpp
+ ekos/guide/opscalibration.cpp
# Internal Guide
ekos/guide/internalguide/common.cpp
ekos/guide/internalguide/gmath.cpp
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 8eec36a..63a097b 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -14,10 +14,12 @@
#include <KMessageBox>
#include <KLed>
#include <KLocalizedString>
+#include <KConfigDialog>
#include <basedevice.h>
#include "Options.h"
+#include "opscalibration.h"
#include "internalguide/internalguider.h"
#include "scroll_graph.h"
@@ -50,10 +52,15 @@ Guide::Guide() : QWidget()
new GuideAdaptor(this);
QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Guide", this);
+ // Devices
currentCCD = NULL;
currentTelescope = NULL;
+
+ // AO Driver
AODriver= NULL;
- GuideDriver=NULL;
+
+ // ST4 Driver
+ GuideDriver=NULL;
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
guideDeviationRA = guideDeviationDEC = 0;
@@ -148,7 +155,14 @@ Guide::Guide() : QWidget()
switch (guiderType)
{
case GUIDE_INTERNAL:
+ {
guider= new InternalGuider();
+ // Options
+ KConfigDialog* dialog = new KConfigDialog(this, "guidesettings", Options::self());
+ opsCalibration = new OpsCalibration(dynamic_cast<InternalGuider*>(guider));
+ dialog->addPage(opsCalibration, i18n("Calibration Settings"));
+ connect(calibrationOptionsB, SIGNAL(clicked()), dialog, SLOT(show()));
+ }
break;
case GUIDE_PHD2:
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 74c1c2a..ca484d1 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -35,6 +35,7 @@ namespace Ekos
{
class GuideInterface;
+class OpsCalibration;
/**
*@class Guide
@@ -203,6 +204,8 @@ public:
void startRapidGuide();
void stopRapidGuide();
+ GuideInterface * getGuider() { return guider;}
+
public slots:
/** DBUS interface function.
@@ -294,7 +297,7 @@ protected slots:
// FIXME
//void onSetDECSwap(bool enable);
- void onControlDirectionChanged(bool enable);
+ void onControlDirectionChanged(bool enable);
signals:
void newLog();
@@ -348,6 +351,10 @@ private:
// Progress Activity Indicator
QProgressIndicator *pi;
+
+ // Options
+ OpsCalibration *opsCalibration;
+
};
}
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index 851a756..a299488 100644
--- a/kstars/ekos/guide/guide.ui
+++ b/kstars/ekos/guide/guide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>696</width>
- <height>508</height>
+ <width>702</width>
+ <height>513</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -82,7 +82,7 @@
</widget>
</item>
<item row="3" column="1">
- <widget class="QPushButton" name="pushButton_2">
+ <widget class="QPushButton" name="guideOptionsB">
<property name="text">
<string>Options</string>
</property>
@@ -604,7 +604,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>458</width>
+ <width>462</width>
<height>238</height>
</rect>
</property>
diff --git a/kstars/ekos/guide/guideinterface.cpp b/kstars/ekos/guide/guideinterface.cpp
index d8c2efc..ff819aa 100644
--- a/kstars/ekos/guide/guideinterface.cpp
+++ b/kstars/ekos/guide/guideinterface.cpp
@@ -56,7 +56,17 @@ bool GuideInterface::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY,
return true;
}
-bool GuideInterface::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t binX, uint8_t binY)
+bool GuideInterface::getGuiderParams(double *ccdPixelSizeX, double *ccdPixelSizeY, double *mountAperture, double *mountFocalLength)
+{
+ *ccdPixelSizeX = this->ccdPixelSizeX;
+ *ccdPixelSizeY = this->ccdPixelSizeY;
+ *mountAperture = this->mountAperture;
+ *mountFocalLength = this->mountFocalLength;
+
+ return true;
+}
+
+bool GuideInterface::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t binX, uint16_t binY)
{
if( w <= 0 || h <= 0 )
return false;
@@ -71,6 +81,20 @@ bool GuideInterface::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t
return true;
}
+
+bool GuideInterface::getFrameParams(uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h, uint16_t *binX, uint16_t *binY)
+{
+ *x = subX;
+ *y = subY;
+ *w = subW;
+ *h = subH;
+
+ *binX = subBinX;
+ *binY = subBinY;
+
+ return true;
+}
+
}
diff --git a/kstars/ekos/guide/guideinterface.h b/kstars/ekos/guide/guideinterface.h
index 19ce99c..d5082dd 100644
--- a/kstars/ekos/guide/guideinterface.h
+++ b/kstars/ekos/guide/guideinterface.h
@@ -42,7 +42,10 @@ public:
virtual bool dither(double pixels) = 0;
virtual bool setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength);
- virtual bool setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t binX, uint8_t binY);
+ virtual bool getGuiderParams(double *ccdPixelSizeX, double *ccdPixelSizeY, double *mountAperture, double *mountFocalLength);
+
+ virtual bool setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t binX, uint16_t binY);
+ virtual bool getFrameParams(uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h, uint16_t *binX, uint16_t *binY);
signals:
void newLog(const QString &);
@@ -55,8 +58,7 @@ signals:
protected:
Ekos::GuideState state;
double ccdPixelSizeX, ccdPixelSizeY, mountAperture, mountFocalLength;
- uint16_t subX, subY, subW, subH;
- uint8_t subBinX, subBinY;
+ uint16_t subX, subY, subW, subH, subBinX, subBinY;
};
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index b0081d0..6517618 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -87,6 +87,16 @@ void InternalGuider::setSquareAlgorithm(int index)
pmath->setSquareAlgorithm(index);
}
+void InternalGuider::setReticleParameters(double x, double y, double angle)
+{
+ pmath->setReticleParameters(x,y,angle);
+}
+
+bool InternalGuider::getReticleParameters(double *x, double *y, double *angle)
+{
+ return pmath->getReticleParameters(x,y,angle);
+}
+
bool InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength)
{
// TODO
diff --git a/kstars/ekos/guide/internalguide/internalguider.h b/kstars/ekos/guide/internalguide/internalguider.h
index e678446..0f825df 100644
--- a/kstars/ekos/guide/internalguide/internalguider.h
+++ b/kstars/ekos/guide/internalguide/internalguider.h
@@ -50,6 +50,10 @@ public:
void setSquareAlgorithm( int index );
+ // Reticle Parameters
+ void setReticleParameters(double x, double y, double angle);
+ bool getReticleParameters(double *x, double *y, double *angle);
+
/// IMPORTED CHECK THEM ALL
diff --git a/kstars/ekos/guide/opscalibration.cpp b/kstars/ekos/guide/opscalibration.cpp
new file mode 100644
index 0000000..f45bc76
--- /dev/null
+++ b/kstars/ekos/guide/opscalibration.cpp
@@ -0,0 +1,71 @@
+/* INDI Options
+ Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ */
+
+#include <QPushButton>
+#include <QFileDialog>
+#include <QCheckBox>
+#include <QStringList>
+#include <QComboBox>
+
+#include <KConfigDialog>
+
+#include "Options.h"
+#include "opscalibration.h"
+#include "guide.h"
+#include "kstars.h"
+
+#include "internalguide/internalguider.h"
+
+namespace Ekos
+{
+
+OpsCalibration::OpsCalibration(InternalGuider *guiderObject) : QFrame( KStars::Instance() )
+{
+ setupUi(this);
+
+ guider = guiderObject;
+
+ //Get a pointer to the KConfigDialog
+ m_ConfigDialog = KConfigDialog::exists( "guidesettings" );
+
+ connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
+ connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
+ connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), SLOT( slotCancel() ) );
+}
+
+
+OpsCalibration::~OpsCalibration() {}
+
+void OpsCalibration::showEvent(QShowEvent *)
+{
+ double x, y, ang;
+ guider->getReticleParameters(&x, &y, &ang);
+
+ spinBox_ReticleX->setValue(x);
+ spinBox_ReticleY->setValue(y);
+ spinBox_ReticleAngle->setValue(ang);
+
+ uint16_t subX,subY,subW,subH,subBinX,subBinY;
+ guider->getFrameParams(&subX, &subY, &subW, &subH, &subBinX, &subBinY);
+
+ spinBox_ReticleX->setMaximum(subW);
+ spinBox_ReticleY->setMaximum(subH);
+}
+
+void OpsCalibration::slotApply()
+{
+ guider->setReticleParameters(spinBox_ReticleX->value(), spinBox_ReticleY->value(), spinBox_ReticleAngle->value());
+}
+
+void OpsCalibration::slotCancel()
+{
+}
+
+}
diff --git a/kstars/ekos/guide/opscalibration.h b/kstars/ekos/guide/opscalibration.h
new file mode 100644
index 0000000..0146122
--- /dev/null
+++ b/kstars/ekos/guide/opscalibration.h
@@ -0,0 +1,53 @@
+/* Ekos Options
+ Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef OpsCalibration_H_
+#define OpsCalibration_H_
+
+#include "ui_opscalibration.h"
+
+class KConfigDialog;
+
+namespace Ekos
+{
+
+class InternalGuider;
+
+/**
+ * @class OpsCalibration
+ *
+ * Enables the user to set guide calibration options
+ *
+ * @author Jasem Mutlaq
+ */
+class OpsCalibration : public QFrame, public Ui::OpsCalibration
+{
+ Q_OBJECT
+
+public:
+ explicit OpsCalibration(InternalGuider *guiderObject);
+ ~OpsCalibration();
+
+protected:
+ void showEvent(QShowEvent *);
+
+private slots:
+
+ void slotApply();
+ void slotCancel();
+
+private:
+ KConfigDialog *m_ConfigDialog;
+ InternalGuider *guider;
+};
+
+}
+
+#endif
+
diff --git a/kstars/ekos/opsekos.h b/kstars/ekos/opsekos.h
index cbd8c27..5a14513 100644
--- a/kstars/ekos/opsekos.h
+++ b/kstars/ekos/opsekos.h
@@ -1,5 +1,5 @@
-/* INDI Options (subclass)
- Copyright (C) 2005 Jasem Mutlaq <mutlaqja@ikarustech.com>
+/* Ekos Options
+ Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public