summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-26 11:22:38 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-26 11:22:38 (GMT)
commite90f2e5566a827d0a2b0d0bc4fef4095c7dd07b0 (patch)
treedf131469ef015e3ea758f1082aab4dcfc5a7ac40
parent5b5277427a6a23a5d9c86d9ff112816beab43192 (diff)
More re-organization to the Ekos code base. Should be ready in a few days
-rw-r--r--kstars/CMakeLists.txt24
-rw-r--r--kstars/ekos/align/align.cpp6
-rw-r--r--kstars/ekos/align/align.h6
-rw-r--r--kstars/ekos/auxiliary/dome.cpp2
-rw-r--r--kstars/ekos/auxiliary/dustcap.cpp2
-rw-r--r--kstars/ekos/auxiliary/weather.cpp2
-rw-r--r--kstars/ekos/capture/capture.cpp14
-rw-r--r--kstars/ekos/capture/capture.h2
-rw-r--r--kstars/ekos/ekosmanager.cpp8
-rw-r--r--kstars/ekos/ekosmanager.h22
-rw-r--r--kstars/ekos/focus/focus.cpp4
-rw-r--r--kstars/ekos/focus/focus.h5
-rw-r--r--kstars/ekos/guide/externalguide/phd2.h6
-rw-r--r--kstars/ekos/guide/guide.cpp254
-rw-r--r--kstars/ekos/guide/guide.h27
-rw-r--r--kstars/ekos/guide/guide.ui2
-rw-r--r--kstars/ekos/guide/guideinterface.cpp1252
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp3
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.h26
-rw-r--r--kstars/ekos/mount/mount.cpp2
-rw-r--r--kstars/ekos/opsekos.cpp27
-rw-r--r--kstars/ekos/opsekos.h3
-rw-r--r--kstars/ekos/scheduler/mosaic.cpp6
-rw-r--r--kstars/ekos/scheduler/scheduler.cpp4
-rw-r--r--kstars/ekos/scheduler/scheduler.h4
-rw-r--r--kstars/kstars.kcfg2
-rw-r--r--kstars/org.kde.kstars.Ekos.Guide.xml13
27 files changed, 219 insertions, 1509 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 46dcfa1..646a0df 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -182,12 +182,12 @@ if (INDI_FOUND)
ekos/guide/internalguide/common.cpp
ekos/guide/internalguide/gmath.cpp
ekos/guide/internalguide/internalguider.cpp
- ekos/guide/internalguide/guider.cpp
+ #ekos/guide/internalguide/guider.cpp
ekos/guide/internalguide/matr.cpp
- ekos/guide/internalguide/rcalibration.cpp
+ #ekos/guide/internalguide/rcalibration.cpp
ekos/guide/internalguide/vect.cpp
# External Guide
- ekos/guide/externalguide/phd2.cpp
+ #ekos/guide/externalguide/phd2.cpp
)
endif(CFITSIO_FOUND)
endif(BUILD_KSTARS_LITE)
@@ -831,15 +831,15 @@ if(NOT BUILD_KSTARS_LITE)
if (INDI_FOUND)
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.INDI.xml indi/indidbus.h INDIDBus)
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.xml ekos/ekosmanager.h EkosManager)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Capture.xml ekos/capture.h Ekos::Capture)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Focus.xml ekos/focus.h Ekos::Focus)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Guide.xml ekos/guide.h Ekos::Guide)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Align.xml ekos/align.h Ekos::Align)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Mount.xml ekos/mount.h Ekos::Mount)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Dome.xml ekos/dome.h Ekos::Dome)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Weather.xml ekos/weather.h Ekos::Weather)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.DustCap.xml ekos/dustcap.h Ekos::DustCap)
- qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Scheduler.xml ekos/scheduler.h Ekos::Scheduler)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Capture.xml ekos/capture/capture.h Ekos::Capture)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Focus.xml ekos/focus/focus.h Ekos::Focus)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Guide.xml ekos/guide/guide.h Ekos::Guide)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Align.xml ekos/align/align.h Ekos::Align)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Mount.xml ekos/mount/mount.h Ekos::Mount)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Dome.xml ekos/auxiliary/dome.h Ekos::Dome)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Weather.xml ekos/auxiliary/weather.h Ekos::Weather)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.DustCap.xml ekos/auxiliary/dustcap.h Ekos::DustCap)
+ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Scheduler.xml ekos/scheduler/scheduler.h Ekos::Scheduler)
endif(INDI_FOUND)
ki18n_wrap_ui(kstars_SRCS
diff --git a/kstars/ekos/align/align.cpp b/kstars/ekos/align/align.cpp
index dfff40b..30f404e 100644
--- a/kstars/ekos/align/align.cpp
+++ b/kstars/ekos/align/align.cpp
@@ -14,7 +14,7 @@
#include "align.h"
#include "dms.h"
#include "fov.h"
-#include "darklibrary.h"
+#include "ekos/auxiliary/darklibrary.h"
#include "Options.h"
@@ -22,7 +22,7 @@
#include <KMessageBox>
#include <KNotifications/KNotification>
-#include "QProgressIndicator.h"
+#include "ekos/auxiliary/QProgressIndicator.h"
#include "indi/driverinfo.h"
#include "indi/indicommon.h"
#include "indi/clientmanager.h"
@@ -32,7 +32,7 @@
#include "fitsviewer/fitstab.h"
#include "fitsviewer/fitsview.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "onlineastrometryparser.h"
#include "offlineastrometryparser.h"
diff --git a/kstars/ekos/align/align.h b/kstars/ekos/align/align.h
index 96d1352..6b9bce0 100644
--- a/kstars/ekos/align/align.h
+++ b/kstars/ekos/align/align.h
@@ -16,14 +16,16 @@
#include <config-kstars.h>
-#include "capture.h"
-
#include "ui_align.h"
+#include "ekos/ekos.h"
+
#include "indi/inditelescope.h"
+#include "indi/indiccd.h"
#include "indi/indistd.h"
class FOV;
+class QProgressIndicator;
namespace Ekos
{
diff --git a/kstars/ekos/auxiliary/dome.cpp b/kstars/ekos/auxiliary/dome.cpp
index 7e9c1a3..8900f8e 100644
--- a/kstars/ekos/auxiliary/dome.cpp
+++ b/kstars/ekos/auxiliary/dome.cpp
@@ -8,7 +8,7 @@
*/
#include "dome.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "domeadaptor.h"
diff --git a/kstars/ekos/auxiliary/dustcap.cpp b/kstars/ekos/auxiliary/dustcap.cpp
index b83eb35..805edb8 100644
--- a/kstars/ekos/auxiliary/dustcap.cpp
+++ b/kstars/ekos/auxiliary/dustcap.cpp
@@ -8,7 +8,7 @@
*/
#include "dustcap.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "dustcapadaptor.h"
diff --git a/kstars/ekos/auxiliary/weather.cpp b/kstars/ekos/auxiliary/weather.cpp
index f045d61..4f63fd7 100644
--- a/kstars/ekos/auxiliary/weather.cpp
+++ b/kstars/ekos/auxiliary/weather.cpp
@@ -8,7 +8,7 @@
*/
#include "weather.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "weatheradaptor.h"
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index 113522c..86ca633 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -34,12 +34,12 @@
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/fitsview.h"
-#include "darklibrary.h"
-#include "ekosmanager.h"
+#include "ekos/auxiliary/darklibrary.h"
+#include "ekos/ekosmanager.h"
#include "captureadaptor.h"
#include "ui_calibrationoptions.h"
-#include "QProgressIndicator.h"
+#include "ekos/auxiliary/QProgressIndicator.h"
#define INVALID_TEMPERATURE 10000
#define INVALID_HA 10000
@@ -93,7 +93,7 @@ Capture::Capture()
dustCapLightEnabled = lightBoxLightEnabled = false;
- //isAutoGuiding = false;
+ //isAutoGuiding = false;
isAutoFocus = false;
autoFocusStatus = false;
resumeAlignmentAfterFlip= false;
@@ -175,7 +175,7 @@ Capture::Capture()
seqCurrentCount = 0;
seqDelay = 0;
fileHFR=0;
- useGuideHead = false;
+ useGuideHead = false;
firstAutoFocus = true;
foreach(QString filter, FITSViewer::filterTypes)
@@ -1113,7 +1113,7 @@ bool Capture::resumeSequence()
emit suspendGuiding(false);
//if (isAutoGuiding && guideDither && activeJob->getFrameType() == FRAME_LIGHT)
- if (guideState == GUIDE_GUIDING && Options::useDither() && activeJob->getFrameType() == FRAME_LIGHT)
+ if (guideState == GUIDE_GUIDING && Options::ditherEnabled() && activeJob->getFrameType() == FRAME_LIGHT)
{
secondsLabel->setText(i18n("Dithering..."));
//emit exposureComplete();
@@ -1406,7 +1406,7 @@ void Capture::updateCaptureProgress(ISD::CCDChip * tChip, double value, IPState
}
//if (isAutoGuiding && Options::useEkosGuider() && currentCCD->getChip(ISD::CCDChip::GUIDE_CCD) == guideChip)
- if (guideState == GUIDE_GUIDING && Options::useEkosGuider() && currentCCD->getChip(ISD::CCDChip::GUIDE_CCD) == guideChip)
+ if (guideState == GUIDE_GUIDING && Options::guiderType() == 0 && currentCCD->getChip(ISD::CCDChip::GUIDE_CCD) == guideChip)
{
if (Options::captureLogging())
qDebug() << "Capture: Autoguiding suspended until primary CCD chip completes downloading...";
diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h
index 5875949..e4d8511 100644
--- a/kstars/ekos/capture/capture.h
+++ b/kstars/ekos/capture/capture.h
@@ -16,7 +16,7 @@
#include "ui_capture.h"
-#include "ekos.h"
+#include "ekos/ekos.h"
#include "fitsviewer/fitscommon.h"
#include "indi/indistd.h"
#include "indi/indiccd.h"
diff --git a/kstars/ekos/ekosmanager.cpp b/kstars/ekos/ekosmanager.cpp
index 06d55dd..7567dba 100644
--- a/kstars/ekos/ekosmanager.cpp
+++ b/kstars/ekos/ekosmanager.cpp
@@ -26,12 +26,12 @@
#include "fitsviewer/fitsviewer.h"
#include "skymap.h"
-#include "sequencejob.h"
-#include "darklibrary.h"
+#include "capture/sequencejob.h"
+#include "auxiliary/darklibrary.h"
#include "profileeditor.h"
#include "profileinfo.h"
-#include "QProgressIndicator.h"
+#include "auxiliary/QProgressIndicator.h"
#include "indi/clientmanager.h"
#include "indi/indielement.h"
@@ -1959,7 +1959,9 @@ void EkosManager::updateGuideStatus(Ekos::GuideState status)
case Ekos::GUIDE_DITHERING:
if (guidePI->isAnimated() == false)
guidePI->startAnimation();
+ break;
+ default:
break;
}
}
diff --git a/kstars/ekos/ekosmanager.h b/kstars/ekos/ekosmanager.h
index a0ad660..df9ec22 100644
--- a/kstars/ekos/ekosmanager.h
+++ b/kstars/ekos/ekosmanager.h
@@ -21,15 +21,15 @@
#include "ekos.h"
#include "indi/indistd.h"
-#include "capture.h"
-#include "focus.h"
-#include "guide.h"
-#include "align.h"
-#include "mount.h"
-#include "dome.h"
-#include "weather.h"
-#include "dustcap.h"
-#include "scheduler.h"
+#include "capture/capture.h"
+#include "focus/focus.h"
+#include "guide/guide.h"
+#include "align/align.h"
+#include "mount/mount.h"
+#include "auxiliary/dome.h"
+#include "auxiliary/weather.h"
+#include "auxiliary/dustcap.h"
+#include "scheduler/scheduler.h"
#include <QDialog>
#include <QHash>
@@ -142,7 +142,7 @@ public slots:
/** @}*/
- void processINDI();
+ void processINDI();
void cleanDevices(bool stopDrivers=true);
void processNewDevice(ISD::GDInterface*);
@@ -185,7 +185,7 @@ private slots:
// Mount Summary
void updateMountCoords(const QString &ra, const QString &dec ,const QString &az ,const QString &alt);
- void updateMountStatus(ISD::Telescope::TelescopeStatus status);
+ void updateMountStatus(ISD::Telescope::TelescopeStatus status);
void setTarget(SkyObject *o);
// Capture Summary
diff --git a/kstars/ekos/focus/focus.cpp b/kstars/ekos/focus/focus.cpp
index 88b4d22..c01179e 100644
--- a/kstars/ekos/focus/focus.cpp
+++ b/kstars/ekos/focus/focus.cpp
@@ -28,8 +28,8 @@
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/fitstab.h"
#include "fitsviewer/fitsview.h"
-#include "ekosmanager.h"
-#include "darklibrary.h"
+#include "ekos/ekosmanager.h"
+#include "ekos/auxiliary/darklibrary.h"
#include "kstars.h"
#include "focusadaptor.h"
diff --git a/kstars/ekos/focus/focus.h b/kstars/ekos/focus/focus.h
index 065f3b1..205b6ba 100644
--- a/kstars/ekos/focus/focus.h
+++ b/kstars/ekos/focus/focus.h
@@ -12,14 +12,15 @@
#include <QtDBus/QtDBus>
+#include "ekos/ekos.h"
#include "focus.h"
-#include "capture.h"
+//#include "capture/capture.h"
#include "ui_focus.h"
#include "indi/indistd.h"
#include "indi/indifocuser.h"
-
+#include "indi/indiccd.h"
namespace Ekos
{
diff --git a/kstars/ekos/guide/externalguide/phd2.h b/kstars/ekos/guide/externalguide/phd2.h
index b78b2f7..90b2a37 100644
--- a/kstars/ekos/guide/externalguide/phd2.h
+++ b/kstars/ekos/guide/externalguide/phd2.h
@@ -42,8 +42,8 @@ public:
PHD2();
~PHD2();
- void Connect() override;
- void Disconnect() override;
+ bool Connect() override;
+ bool Disconnect() override;
bool calibrate() override;
bool guide() override;
@@ -55,7 +55,7 @@ public:
private slots:
void readPHD2();
- void displayError(QAbstractSocket::SocketError socketError);
+ void displayError(QAbstractSocket::SocketError socketError);
private:
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 7bb4368..89dd6cd 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -24,6 +24,8 @@
#include "externalguide/phd2.h"
#include "ekos/auxiliary/darklibrary.h"
+#include "ekos/auxiliary/QProgressIndicator.h"
+
#include "indi/driverinfo.h"
#include "indi/clientmanager.h"
@@ -72,7 +74,7 @@ Guide::Guide() : QWidget()
connect(guiderCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
// Dark Frame Check
- darkFrameCheck->setChecked(Options::useGuideDarkFrame());
+ darkFrameCheck->setChecked(Options::guideDarkFrameEnabled());
connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
// ST4 Selection
@@ -88,8 +90,8 @@ Guide::Guide() : QWidget()
// MOVE THIS TO GUIDE OPTIONS
- connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
- connect( ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
+ //connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
+ //connect( ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
// Guiding Rate - Advisory only
connect( spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
@@ -132,7 +134,7 @@ Guide::Guide() : QWidget()
// Progress Indicator
pi = new QProgressIndicator(this);
- controlLayout->addWidget(pi, 0, 1);
+ controlLayout->addWidget(pi, 0, 1, 1, 1);
// Drift Graph
driftGraph = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
@@ -141,7 +143,7 @@ Guide::Guide() : QWidget()
//ui.frame_Graph->resize( driftGraph_WIDTH + 2*ui.frame_Graph->frameWidth(), driftGraph_HEIGHT + 2*ui.frame_Graph->frameWidth() );
- guiderType = static_cast<GuiderType>(Options::GuiderType());
+ guiderType = static_cast<GuiderType>(Options::guiderType());
switch (guiderType)
{
@@ -172,9 +174,6 @@ Guide::Guide() : QWidget()
Guide::~Guide()
{
delete guider;
- delete calibration;
- delete pmath;
- delete phd2;
}
void Guide::setDefaultCCD(QString ccd)
@@ -196,7 +195,7 @@ void Guide::addCCD(ISD::GDInterface *newCCD)
//checkCCD(CCDs.count()-1);
//guiderCombo->setCurrentIndex(CCDs.count()-1);
- setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
+ // setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
}
void Guide::addGuideHead(ISD::GDInterface *newCCD)
@@ -216,7 +215,7 @@ void Guide::addGuideHead(ISD::GDInterface *newCCD)
//checkCCD(CCDs.count()-1);
//guiderCombo->setCurrentIndex(CCDs.count()-1);
- setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
+ //setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
}
@@ -267,7 +266,7 @@ void Guide::checkCCD(int ccdNum)
}
}
-void Guide::setGuiderProcess(int guiderProcess)
+/*void Guide::setGuiderProcess(int guiderProcess)
{
// Don't do anything unless we have a CCD and it is online
if (currentCCD == NULL || currentCCD->isConnected() == false)
@@ -302,7 +301,7 @@ void Guide::setGuiderProcess(int guiderProcess)
// Receive BLOBs from the driver
currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_ALSO, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
}
-}
+}*/
void Guide::syncCCDInfo()
{
@@ -406,19 +405,24 @@ void Guide::updateGuideParams()
if (ccd_hor_pixel != -1 && ccd_ver_pixel != -1 && focal_length != -1 && aperture != -1)
{
- pmath->setGuiderParameters(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
- phd2->setCCDMountParams(ccd_hor_pixel, ccd_ver_pixel, focal_length);
+ guider->setGuiderParams(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
+ //pmath->setGuiderParameters(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
+ //phd2->setCCDMountParams(ccd_hor_pixel, ccd_ver_pixel, focal_length);
+
- int x,y,w,h;
emit guideChipUpdated(targetChip);
- guider->setTargetChip(targetChip);
+ //guider->setTargetChip(targetChip);
+ int x,y,w,h;
if (targetChip->getFrame(&x,&y,&w,&h))
- pmath->setVideoParameters(w, h);
+ {
+ guider->setFrameParams(w,h);
+ //pmath->setVideoParameters(w, h);
+ }
- guider->setInterface();
+ //guider->setInterface();
}
}
@@ -466,7 +470,7 @@ void Guide::newST4(int index)
void Guide::setAO(ISD::ST4 *newAO)
{
AODriver = newAO;
- guider->setAO(true);
+ //guider->setAO(true);
}
bool Guide::capture()
@@ -485,6 +489,9 @@ bool Guide::capture()
}
//If calibrating, reset frame
+
+ // FIXME
+ /*
if (calibration->getCalibrationStage() == internalCalibration::CAL_CAPTURE_IMAGE)
{
targetChip->resetFrame();
@@ -510,6 +517,7 @@ bool Guide::capture()
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
targetChip->capture(seqExpose);
+ */
return true;
@@ -526,7 +534,7 @@ void Guide::newFITS(IBLOB *bp)
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
// Do we need to take a dark frame?
- if (Options::useGuideDarkFrame())
+ if (Options::guideDarkFrameEnabled())
{
int x,y,w,h;
int binx,biny;
@@ -562,6 +570,9 @@ void Guide::newFITS(IBLOB *bp)
void Guide::setCaptureComplete()
{
+ // FIXME
+ /*
+
DarkLibrary::Instance()->disconnect(this);
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
@@ -647,6 +658,8 @@ void Guide::setCaptureComplete()
}
emit newStarPixmap(targetImage->getTrackingBoxPixmap());
+
+ */
}
void Guide::appendLogText(const QString &text)
@@ -671,18 +684,25 @@ void Guide::setDECSwap(bool enable)
if (ST4Driver == NULL || guider == NULL)
return;
+ // FIXME
+ /*
guider->setDECSwap(enable);
ST4Driver->setDECSwap(enable);
+ */
}
bool Guide::sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs )
{
+
if (GuideDriver == NULL || (ra_dir == NO_DIR && dec_dir == NO_DIR))
return false;
+ // FIXME
+ /*
if (calibration->isCalibrating())
QTimer::singleShot( (ra_msecs > dec_msecs ? ra_msecs : dec_msecs) + 100, this, SLOT(capture()));
+ */
return GuideDriver->doPulse(ra_dir, ra_msecs, dec_dir, dec_msecs);
}
@@ -692,8 +712,11 @@ bool Guide::sendPulse( GuideDirection dir, int msecs )
if (GuideDriver == NULL || dir==NO_DIR)
return false;
+ // FIXME
+ /*
if (calibration->isCalibrating())
QTimer::singleShot(msecs+100, this, SLOT(capture()));
+ */
return GuideDriver->doPulse(dir, msecs);
@@ -709,11 +732,6 @@ QStringList Guide::getST4Devices()
return devices;
}
-double Guide::getReticleAngle()
-{
- return calibration->getReticleAngle();
-}
-
/*void Guide::viewerClosed()
{
pmath->set_image(NULL);
@@ -723,10 +741,13 @@ double Guide::getReticleAngle()
void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit)
{
+ // FIXME
+ /*
// Check if guide star is lost
if (dx == -1 && dy == -1 && fit == -1)
{
KMessageBox::error(NULL, i18n("Lost track of the guide star. Rapid guide aborted."));
+
guider->abort();
return;
}
@@ -769,10 +790,15 @@ void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy,
capture();
}
+ */
+
}
void Guide::startRapidGuide()
{
+
+ // FIXME
+ /*
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
if (currentCCD->setRapidGuide(targetChip, true) == false)
@@ -787,11 +813,15 @@ void Guide::startRapidGuide()
pmath->setRapidGuide(true);
currentCCD->configureRapidGuide(targetChip, true);
connect(currentCCD, SIGNAL(newGuideStarData(ISD::CCDChip*,double,double,double)), this, SLOT(processRapidStarData(ISD::CCDChip*,double,double,double)));
+ */
}
void Guide::stopRapidGuide()
{
+
+ // FIXME
+ /*
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
pmath->setRapidGuide(false);
@@ -803,17 +833,16 @@ void Guide::stopRapidGuide()
currentCCD->configureRapidGuide(targetChip, false, false, false);
currentCCD->setRapidGuide(targetChip, false);
+ */
}
-bool Guide::isDithering()
-{
- return (Options::useEkosGuider() ? guider->isDithering() : phd2->isDithering());
-}
-
void Guide::dither()
{
+
+ // FIXME
+ /*
if (Options::useEkosGuider())
{
if (isDithering() == false)
@@ -825,10 +854,15 @@ void Guide::dither()
phd2->dither(guider->getDitherPixels());
}
+ */
+
}
void Guide::updateGuideDriver(double delta_ra, double delta_dec)
{
+
+ // FIXME
+ /*
guideDeviationRA = delta_ra;
guideDeviationDEC = delta_dec;
@@ -855,70 +889,58 @@ void Guide::updateGuideDriver(double delta_ra, double delta_dec)
appendLogText(i18n("Using %1 to correct for guiding errors.", ST4Driver->getDeviceName()));
GuideDriver = ST4Driver;
-}
-
-bool Guide::isCalibrationComplete()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrationComplete();
- else
- return phd2->isCalibrationComplete();
-
-}
-
-bool Guide::isCalibrationSuccessful()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrationSuccessful();
- else
- return phd2->isCalibrationSuccessful();
+ */
}
bool Guide::startCalibration()
{
+ // FIXME
+ /*
if (Options::useEkosGuider())
return calibration->startCalibration();
else
return phd2->startGuiding();
+
+ */
+
+ return true;
}
bool Guide::stopCalibration()
{
+ // FIXME
+ /*
if (Options::useEkosGuider())
return calibration->stopCalibration();
else
return phd2->stopGuiding();
-}
-bool Guide::isCalibrating()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrating();
- else
- return phd2->isCalibrating();
-}
+ */
-bool Guide::isGuiding()
-{
- if (Options::useEkosGuider())
- return guider->isGuiding();
- else
- return phd2->isGuiding();
+ return true;
}
bool Guide::startGuiding()
{
+ // FIXME
+ /*
// This will handle both internal and external guiders
return guider->start();
- /*if (Options::useEkosGuider())
+ if (Options::useEkosGuider())
return guider->start();
else
- return phd2->startGuiding();*/
+ return phd2->startGuiding();
+
+ */
+return true;
+
}
bool Guide::stopGuiding()
{
+ // FIXME
+ /*
isSuspended=false;
if (Options::useEkosGuider())
@@ -926,10 +948,14 @@ bool Guide::stopGuiding()
else
// guider stop will call phd2->stopGuide() and change GUI elements accordingly
return guider->stop();
+ */
+
+ return true;
}
void Guide::setSuspended(bool enable)
{
+ /*
if (enable == isSuspended || (enable && isGuiding() == false))
return;
@@ -957,6 +983,7 @@ void Guide::setSuspended(bool enable)
{
appendLogText(i18n("Guiding resumed."));
}
+ */
}
void Guide::setExposure(double value)
@@ -977,47 +1004,47 @@ void Guide::setImageFilter(const QString & value)
void Guide::setCalibrationTwoAxis(bool enable)
{
- calibration->setCalibrationTwoAxis(enable);
+ // calibration->setCalibrationTwoAxis(enable);
}
void Guide::setCalibrationAutoStar(bool enable)
{
- calibration->setCalibrationAutoStar(enable);
+ //calibration->setCalibrationAutoStar(enable);
}
void Guide::setCalibrationAutoSquareSize(bool enable)
{
- calibration->setCalibrationAutoSquareSize(enable);
+ //calibration->setCalibrationAutoSquareSize(enable);
}
void Guide::setCalibrationPulseDuration(int pulseDuration)
{
- calibration->setCalibrationPulseDuration(pulseDuration);
+ // calibration->setCalibrationPulseDuration(pulseDuration);
}
void Guide::setGuideBoxSizeIndex(int boxSize)
{
- boxSizeCombo->setCurrentIndex(boxSize);
+ //boxSizeCombo->setCurrentIndex(boxSize);
}
void Guide::setGuideAlgorithm(const QString & algorithm)
{
- guider->setGuideOptions(algorithm, guider->useSubFrame(), guider->useRapidGuide());
+ //guider->setGuideOptions(algorithm, guider->useSubFrame(), guider->useRapidGuide());
}
void Guide::setSubFrameEnabled(bool enable)
{
- guider->setGuideOptions(guider->getAlgorithm(), enable , guider->useRapidGuide());
+ //guider->setGuideOptions(guider->getAlgorithm(), enable , guider->useRapidGuide());
}
void Guide::setGuideRapid(bool enable)
{
- guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , enable);
+ //guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , enable);
}
void Guide::setDither(bool enable, double value)
{
- guider->setDither(enable, value);
+ //guider->setDither(enable, value);
}
QList<double> Guide::getGuidingDeviation()
@@ -1031,16 +1058,22 @@ QList<double> Guide::getGuidingDeviation()
void Guide::startAutoCalibrateGuiding()
{
+ // FIXME
+ /*
if (Options::useEkosGuider())
connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(checkAutoCalibrateGuiding(Ekos::GuideState)));
else
connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(checkAutoCalibrateGuiding(Ekos::GuideState)));
startCalibration();
+
+ */
}
void Guide::checkAutoCalibrateGuiding(Ekos::GuideState state)
{
+ // FIXME
+ /*
if (state < GUIDE_CALIBRATION_SUCESS || state > GUIDE_CALIBRATION_ERROR)
return;
@@ -1058,6 +1091,7 @@ void Guide::checkAutoCalibrateGuiding(Ekos::GuideState state)
{
appendLogText(i18n("Auto calibration failed."));
}
+ */
}
void Guide::setStatus(Ekos::GuideState newState)
@@ -1070,59 +1104,10 @@ void Guide::setStatus(Ekos::GuideState newState)
emit newStatus(newState);
}
-QString Guide::getStatusString(Ekos::GuideState state)
-{
-
- switch (state)
- {
- case GUIDE_IDLE:
- return i18n("Idle");
- break;
-
- case GUIDE_CALIBRATING:
- return i18n("Calibrating");
- break;
-
- case GUIDE_CALIBRATION_SUCESS:
- return i18n("Calibration successful");
- break;
-
- case GUIDE_CALIBRATION_ERROR:
- return i18n("Calibration error");
- break;
-
- case GUIDE_GUIDING:
- return i18n("Guiding");
- break;
-
- case GUIDE_ABORTED:
- return i18n("Aborted");
- break;
-
-
- case GUIDE_SUSPENDED:
- return i18n("Suspended");
- break;
-
- case GUIDE_DITHERING:
- return i18n("Dithering");
- break;
-
- case GUIDE_DITHERING_SUCCESS:
- return i18n("Dithering successful");
- break;
-
- case GUIDE_DITHERING_ERROR:
- return i18n("Dithering error");
- break;
-
- }
-
- return i18n("Unknown");
-}
-
void Guide::updateCCDBin(int index)
{
+ // FIXME
+ /*
if (currentCCD == NULL && Options::usePHD2Guider())
return;
@@ -1130,6 +1115,8 @@ void Guide::updateCCDBin(int index)
targetChip->setBinning(index+1, index+1);
+ */
+
}
void Guide::processCCDNumber(INumberVectorProperty *nvp)
@@ -1147,6 +1134,8 @@ void Guide::processCCDNumber(INumberVectorProperty *nvp)
void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState state)
{
+ // FIXME
+ /*
INDI_UNUSED(exposure);
if (state == IPS_ALERT && (guider->isGuiding() || guider->isDithering() || calibration->isCalibrating()))
@@ -1154,12 +1143,15 @@ void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPStat
appendLogText(i18n("Exposure failed. Restarting exposure..."));
targetChip->capture(exposureIN->value());
}
+ */
}
void Guide::setDarkFrameEnabled(bool enable)
{
+ // FIXME
+ /*
Options::setUseGuideDarkFrame(enable);
-
+*/
/*if (enable && calibration && calibration->useAutoStar())
appendLogText(i18n("Warning: In auto mode, you will not be asked to cover cameras unequipped with shutters in order to capture a dark frame. The dark frame capture will proceed without warning."
" You can capture dark frames with auto mode off and they shall be saved in the dark library for use when ever needed."));*/
@@ -1373,12 +1365,12 @@ void Guide::onInfoRateChanged( double val )
void Guide::onEnableDirRA(bool enable)
{
- Options::setEnableRAGuide(enable);
+ //Options::setEnableRAGuide(enable);
}
void Guide::onEnableDirDEC(bool enable)
{
- Options::setEnableDECGuide(enable);
+ //Options::setEnableDECGuide(enable);
}
void Guide::onInputParamChanged()
@@ -1418,6 +1410,8 @@ void Guide::onInputParamChanged()
void Guide::onControlDirectionChanged(bool enable)
{
+ // FIXME
+ /*
QObject *obj = sender();
if (northControlCheck == dynamic_cast<QCheckBox*>(obj))
@@ -1436,10 +1430,14 @@ void Guide::onControlDirectionChanged(bool enable)
{
Options::setEnableEastRAGuide(enable);
}
+
+ */
}
-void internalGuider::onRapidGuideChanged(bool enable)
+void Guide::onRapidGuideChanged(bool enable)
{
+ // FIXME
+ /*
if (m_isStarted)
{
guideModule->appendLogText(i18n("You must stop auto guiding before changing this setting."));
@@ -1455,6 +1453,8 @@ void internalGuider::onRapidGuideChanged(bool enable)
else
guideModule->appendLogText(i18n("Rapid Guiding is disabled."));
+ */
+
}
}
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index cfd769c..c16aa33 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -29,6 +29,7 @@
class QTabWidget;
class FITSData;
class ScrollGraph;
+class QProgressIndicator;
namespace Ekos
{
@@ -80,25 +81,11 @@ public:
*/
Q_SCRIPTABLE QStringList getST4Devices();
- /** DBUS interface function.
- * @return Returns true if calibraiton is in progress.
- */
- Q_SCRIPTABLE bool isCalibrating();
-
- /** DBUS interface function.
- * @return Returns true if calibration procedure is complete.
- */
- Q_SCRIPTABLE bool isCalibrationComplete();
-
- /** DBUS interface function.
- * @return Returns true if calibration procedure is successful.
- */
- Q_SCRIPTABLE bool isCalibrationSuccessful();
-
- /** DBUS interface function.
- * @return Returns true if autoguiding is in progress.
+ /**
+ * @brief getStatus Return guide module status
+ * @return state of guide module from Ekos::GuideState
*/
- Q_SCRIPTABLE bool isGuiding();
+ Q_SCRIPTABLE uint getStatus() { return state;}
/** DBUS interface function.
* @return Returns guiding deviation from guide star in arcsecs. First elemenet is RA guiding deviation, second element is DEC guiding deviation.
@@ -212,13 +199,9 @@ public:
void setTrackingBoxSize(int index) { boxSizeCombo->setCurrentIndex(index); }
int getTrackingBoxSize() { return boxSizeCombo->currentText().toInt(); }
- double getReticleAngle();
-
void startRapidGuide();
void stopRapidGuide();
- static QString getStatusString(Ekos::GuideState state);
-
public slots:
/** DBUS interface function.
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index 930245c..851a756 100644
--- a/kstars/ekos/guide/guide.ui
+++ b/kstars/ekos/guide/guide.ui
@@ -1126,7 +1126,7 @@
<customwidget>
<class>FITSView</class>
<extends>QScrollArea</extends>
- <header>fitsview.h</header>
+ <header>fitsviewer/fitsview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/kstars/ekos/guide/guideinterface.cpp b/kstars/ekos/guide/guideinterface.cpp
index 50ae889..0d8edc6 100644
--- a/kstars/ekos/guide/guideinterface.cpp
+++ b/kstars/ekos/guide/guideinterface.cpp
@@ -19,18 +19,18 @@
#include "Options.h"
-#include "guide/gmath.h"
-#include "guide/guider.h"
-#include "phd2.h"
+#include "guideinterface.h"
+#include "internalguide/gmath.h"
+
+#include "ekos/auxiliary/darklibrary.h"
-#include "darklibrary.h"
#include "indi/driverinfo.h"
#include "indi/clientmanager.h"
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/fitsview.h"
-#include "guide/rcalibration.h"
+//#include "guide/rcalibration.h"
#include "guideadaptor.h"
#include "kspaths.h"
@@ -41,7 +41,7 @@ namespace Ekos
GuideInterface::GuideInterface()
{
- width=height=0;
+ ccdFrameWidth=ccdFrameHeight=0;
ccdPixelSizeX=ccdPixelSizeY=mountAperture=mountFocalLength=0;
}
@@ -60,1247 +60,11 @@ bool GuideInterface::setFrameParams(uint16_t width, uint16_t height)
if( width <= 0 || height <= 0 )
return false;
- this->width = width;
- this->height = height;
+ ccdFrameWidth = width;
+ ccdFrameHeight = height;
return true;
}
-
-Guide::Guide() : QWidget()
-{
- setupUi(this);
-
- new GuideAdaptor(this);
- QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Guide", this);
-
- currentCCD = NULL;
- currentTelescope = NULL;
- ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
- useGuideHead = false;
- rapidGuideReticleSet = false;
- isSuspended = false;
- AODriver= NULL;
- GuideDriver=NULL;
- calibration=NULL;
- guider=NULL;
-
- state = GUIDE_IDLE;
-
- guideDeviationRA = guideDeviationDEC = 0;
-
- exposureIN->setValue(Options::guideExposure());
- connect(exposureIN, SIGNAL(editingFinished()), this, SLOT(saveDefaultGuideExposure()));
-
- boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex());
- connect(boxSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrackingBoxSize(int)));
-
- // TODO must develop a parent abstract GuideProcess class that is then inherited by both the internal guider and PHD2 and any additional future guiders
- // It should provide the interface to hook its actions and results here instead of this mess.
- pmath = new cgmath();
-
- connect(pmath, SIGNAL(newAxisDelta(double,double)), this, SIGNAL(newAxisDelta(double,double)));
- connect(pmath, SIGNAL(newAxisDelta(double,double)), this, SLOT(updateGuideDriver(double,double)));
- connect(pmath, SIGNAL(newStarPosition(QVector3D,bool)), this, SLOT(setStarPosition(QVector3D,bool)));
-
- calibration = new internalCalibration(pmath, this);
-
- connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
-
- guider = new internalGuider(pmath, this);
-
- connect(guider, SIGNAL(ditherToggled(bool)), this, SIGNAL(ditherToggled(bool)));
- //connect(guider, SIGNAL(autoGuidingToggled(bool)), this, SIGNAL(autoGuidingToggled(bool)));
- //connect(guider, SIGNAL(ditherComplete()), this, SIGNAL(ditherComplete()));
- connect(guider, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
- connect(guider, SIGNAL(newProfilePixmap(QPixmap &)), this, SIGNAL(newProfilePixmap(QPixmap &)));
- connect(guider, SIGNAL(newStarPosition(QVector3D,bool)), this, SLOT(setStarPosition(QVector3D,bool)));
-
- tabWidget->addTab(calibration, calibration->windowTitle());
- tabWidget->addTab(guider, guider->windowTitle());
- tabWidget->setTabEnabled(1, false);
-
- connect(ST4Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(newST4(int)));
- connect(ST4Combo, SIGNAL(activated(QString)), this, SLOT(setDefaultST4(QString)));
-
- connect(guiderCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
- connect(guiderCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
-
- connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
-
- foreach(QString filter, FITSViewer::filterTypes)
- filterCombo->addItem(filter);
-
- darkFrameCheck->setChecked(Options::useGuideDarkFrame());
- connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
-
- phd2 = new PHD2();
-
- connect(phd2, SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
- connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
- connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), guider, SLOT(toggleExternalGuideStateGUI(Ekos::GuideState)));
-
- connect(phd2, SIGNAL(newAxisDelta(double,double)), this, SIGNAL(newAxisDelta(double,double)));
- //connect(phd2, SIGNAL(guideReady()), this, SIGNAL(guideReady()));
- //connect(phd2, SIGNAL(autoGuidingToggled(bool)), this, SIGNAL(autoGuidingToggled(bool)));
- //connect(phd2, SIGNAL(autoGuidingToggled(bool)), guider, SLOT(setGuideState(bool)));
- //connect(phd2, SIGNAL(ditherComplete()), this, SIGNAL(ditherComplete()));
-
- if (Options::usePHD2Guider())
- phd2->connectPHD2();
-}
-
-Guide::~Guide()
-{
- delete guider;
- delete calibration;
- delete pmath;
- delete phd2;
-}
-
-void Guide::setDefaultCCD(QString ccd)
-{
- Options::setDefaultGuideCCD(ccd);
-}
-
-void Guide::addCCD(ISD::GDInterface *newCCD)
-{
- ISD::CCD *ccd = static_cast<ISD::CCD*>(newCCD);
-
- if (CCDs.contains(ccd))
- return;
-
- CCDs.append(ccd);
-
- guiderCombo->addItem(ccd->getDeviceName());
-
- //checkCCD(CCDs.count()-1);
- //guiderCombo->setCurrentIndex(CCDs.count()-1);
-
- setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
-}
-
-void Guide::addGuideHead(ISD::GDInterface *newCCD)
-{
- ISD::CCD *ccd = static_cast<ISD::CCD *> (newCCD);
-
- CCDs.append(ccd);
-
- QString guiderName = ccd->getDeviceName() + QString(" Guider");
-
- if (guiderCombo->findText(guiderName) == -1)
- {
- guiderCombo->addItem(guiderName);
- //CCDs.append(static_cast<ISD::CCD *> (newCCD));
- }
-
- //checkCCD(CCDs.count()-1);
- //guiderCombo->setCurrentIndex(CCDs.count()-1);
-
- setGuiderProcess(Options::useEkosGuider() ? GUIDE_INTERNAL : GUIDE_PHD2);
-
-}
-
-void Guide::setTelescope(ISD::GDInterface *newTelescope)
-{
- currentTelescope = (ISD::Telescope*) newTelescope;
-
- syncTelescopeInfo();
-
-}
-
-bool Guide::setCCD(QString device)
-{
- for (int i=0; i < guiderCombo->count(); i++)
- if (device == guiderCombo->itemText(i))
- {
- guiderCombo->setCurrentIndex(i);
- return true;
- }
-
- return false;
-}
-
-void Guide::checkCCD(int ccdNum)
-{
- if (ccdNum == -1)
- {
- ccdNum = guiderCombo->currentIndex();
-
- if (ccdNum == -1)
- return;
- }
-
- if (ccdNum <= CCDs.count())
- {
- currentCCD = CCDs.at(ccdNum);
-
- //connect(currentCCD, SIGNAL(FITSViewerClosed()), this, SLOT(viewerClosed()), Qt::UniqueConnection);
- connect(currentCCD, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(processCCDNumber(INumberVectorProperty*)), Qt::UniqueConnection);
- connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(checkExposureValue(ISD::CCDChip*,double,IPState)), Qt::UniqueConnection);
-
- if (currentCCD->hasGuideHead() && guiderCombo->currentText().contains("Guider"))
- useGuideHead=true;
- else
- useGuideHead=false;
-
- syncCCDInfo();
- }
-}
-
-void Guide::setGuiderProcess(int guiderProcess)
-{
- // Don't do anything unless we have a CCD and it is online
- if (currentCCD == NULL || currentCCD->isConnected() == false)
- return;
-
- if (guiderProcess == GUIDE_PHD2)
- {
- // Disable calibration tab
- tabWidget->setTabEnabled(0, false);
- // Enable guide tab
- tabWidget->setTabEnabled(1, true);
- // Set current tab to guide
- tabWidget->setCurrentIndex(1);
-
- guider->setPHD2(phd2);
-
- // Do not receive BLOBs from the driver
- currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
- }
- else
- {
- // Enable calibration tab
- tabWidget->setTabEnabled(0, true);
- // Disable guide tab?
- // TODO: Check if calibration is already complete, then no need to disable guiding tab
- tabWidget->setTabEnabled(1, false);
- // Set current tab to calibration
- tabWidget->setCurrentIndex(0);
-
- guider->setPHD2(NULL);
-
- // Receive BLOBs from the driver
- currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_ALSO, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
- }
-}
-
-void Guide::syncCCDInfo()
-{
- INumberVectorProperty * nvp = NULL;
-
- if (currentCCD == NULL)
- return;
-
- if (useGuideHead)
- nvp = currentCCD->getBaseDevice()->getNumber("GUIDER_INFO");
- else
- nvp = currentCCD->getBaseDevice()->getNumber("CCD_INFO");
-
- if (nvp)
- {
- INumber *np = IUFindNumber(nvp, "CCD_PIXEL_SIZE_X");
- if (np)
- ccd_hor_pixel = np->value;
-
- np = IUFindNumber(nvp, "CCD_PIXEL_SIZE_Y");
- if (np)
- ccd_ver_pixel = np->value;
-
- np = IUFindNumber(nvp, "CCD_PIXEL_SIZE_Y");
- if (np)
- ccd_ver_pixel = np->value;
- }
-
- updateGuideParams();
-}
-
-void Guide::syncTelescopeInfo()
-{
- if (currentTelescope == NULL)
- return;
-
- INumberVectorProperty * nvp = currentTelescope->getBaseDevice()->getNumber("TELESCOPE_INFO");
-
- if (nvp)
- {
- INumber *np = IUFindNumber(nvp, "GUIDER_APERTURE");
-
- if (np && np->value != 0)
- aperture = np->value;
- else
- {
- np = IUFindNumber(nvp, "TELESCOPE_APERTURE");
- if (np)
- aperture = np->value;
- }
-
- np = IUFindNumber(nvp, "GUIDER_FOCAL_LENGTH");
- if (np && np->value != 0)
- focal_length = np->value;
- else
- {
- np = IUFindNumber(nvp, "TELESCOPE_FOCAL_LENGTH");
- if (np)
- focal_length = np->value;
- }
- }
-
- updateGuideParams();
-
-}
-
-void Guide::updateGuideParams()
-{
- if (currentCCD == NULL)
- return;
-
- if (currentCCD->hasGuideHead() == false)
- useGuideHead = false;
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- if (targetChip == NULL)
- {
- appendLogText(i18n("Connection to the guide CCD is lost."));
- return;
- }
-
- binningCombo->setEnabled(targetChip->canBin());
- if (targetChip->canBin())
- {
- int binX,binY, maxBinX, maxBinY;
- targetChip->getBinning(&binX, &binY);
- targetChip->getMaxBin(&maxBinX, &maxBinY);
-
- binningCombo->disconnect();
-
- binningCombo->clear();
-
- for (int i=1; i <= maxBinX; i++)
- binningCombo->addItem(QString("%1x%2").arg(i).arg(i));
-
- binningCombo->setCurrentIndex(binX-1);
-
- connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
- }
-
- if (ccd_hor_pixel != -1 && ccd_ver_pixel != -1 && focal_length != -1 && aperture != -1)
- {
- pmath->setGuiderParameters(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
- phd2->setCCDMountParams(ccd_hor_pixel, ccd_ver_pixel, focal_length);
-
- int x,y,w,h;
-
- emit guideChipUpdated(targetChip);
-
- guider->setTargetChip(targetChip);
-
- if (targetChip->getFrame(&x,&y,&w,&h))
- pmath->setVideoParameters(w, h);
-
- guider->setInterface();
-
- }
-}
-
-void Guide::addST4(ISD::ST4 *newST4)
-{
- foreach(ISD::ST4 *guidePort, ST4List)
- {
- if (!strcmp(guidePort->getDeviceName(),newST4->getDeviceName()))
- return;
- }
-
- ST4List.append(newST4);
-
- ST4Combo->addItem(newST4->getDeviceName());
-}
-
-bool Guide::setST4(QString device)
-{
- for (int i=0; i < ST4List.count(); i++)
- if (ST4List.at(i)->getDeviceName() == device)
- {
- ST4Combo->setCurrentIndex(i);
- return true;
- }
-
- return false;
-}
-
-void Guide::setDefaultST4(QString st4)
-{
- Options::setDefaultST4Driver(st4);
-}
-
-void Guide::newST4(int index)
-{
- if (ST4List.empty() || index >= ST4List.count())
- return;
-
- ST4Driver = ST4List.at(index);
-
- GuideDriver = ST4Driver;
-}
-
-void Guide::setAO(ISD::ST4 *newAO)
-{
- AODriver = newAO;
- guider->setAO(true);
-}
-
-bool Guide::capture()
-{
- if (currentCCD == NULL)
- return false;
-
- double seqExpose = exposureIN->value();
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- if (currentCCD->isConnected() == false)
- {
- appendLogText(i18n("Error: Lost connection to CCD."));
- return false;
- }
-
- //If calibrating, reset frame
- if (calibration->getCalibrationStage() == internalCalibration::CAL_CAPTURE_IMAGE)
- {
- targetChip->resetFrame();
- guider->setSubFramed(false);
- }
-
- targetChip->setCaptureMode(FITS_GUIDE);
- targetChip->setFrameType(FRAME_LIGHT);
-
- if (Options::useGuideDarkFrame())
- targetChip->setCaptureFilter(FITS_NONE);
- else
- targetChip->setCaptureFilter((FITSScale) filterCombo->currentIndex());
-
- if (guider->isGuiding())
- {
- if (guider->isRapidGuide() == false)
- connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
-
- targetChip->capture(seqExpose);
- return true;
- }
-
- connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
- targetChip->capture(seqExpose);
-
- return true;
-
-}
-
-void Guide::newFITS(IBLOB *bp)
-{
- INDI_UNUSED(bp);
-
- //FITSViewer *fv = currentCCD->getViewer();
-
- disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- // Do we need to take a dark frame?
- if (Options::useGuideDarkFrame())
- {
- int x,y,w,h;
- int binx,biny;
-
- targetChip->getFrame(&x,&y,&w,&h);
- targetChip->getBinning(&binx,&biny);
-
- FITSView *currentImage = targetChip->getImage(FITS_GUIDE);
- FITSData *darkData = NULL;
- uint16_t offsetX = x / binx;
- uint16_t offsetY = y / biny;
-
- darkData = DarkLibrary::Instance()->getDarkFrame(targetChip, exposureIN->value());
-
- connect(DarkLibrary::Instance(), SIGNAL(darkFrameCompleted(bool)), this, SLOT(setCaptureComplete()));
- connect(DarkLibrary::Instance(), SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
-
- if (darkData)
- DarkLibrary::Instance()->subtract(darkData, currentImage, targetChip->getCaptureFilter(), offsetX, offsetY);
- else
- {
- //if (calibration->useAutoStar() == false)
- //KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
-
- DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
- }
- return;
- }
-
- setCaptureComplete();
-}
-
-void Guide::setCaptureComplete()
-{
-
- DarkLibrary::Instance()->disconnect(this);
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
-
- if (targetImage == NULL)
- {
- if (Options::guideLogging())
- qDebug() << "Guide: guide frame is missing! Capturing again...";
-
- capture();
- return;
- }
-
- if (Options::guideLogging())
- qDebug() << "Guide: received guide frame.";
-
- FITSData *image_data = targetImage->getImageData();
- Q_ASSERT(image_data);
-
- pmath->setImageView(targetImage);
- guider->setImageView(targetImage);
-
- int subBinX=1, subBinY=1;
- targetChip->getBinning(&subBinX, &subBinY);
-
- // It should be false in case we do not need to process the image for motion
- // which happens when we take an image for auto star selection.
- if (calibration->setImageView(targetImage) == false)
- return;
-
- if (starCenter.x() == 0 && starCenter.y() == 0)
- {
- int x,y,w,h;
- targetChip->getFrame(&x,&y,&w,&h);
-
- starCenter.setX(w/(2*subBinX));
- starCenter.setY(h/(2*subBinY));
- starCenter.setZ(subBinX);
- }
-
- syncTrackingBoxPosition();
-
- if (isSuspended)
- {
- if (Options::guideLogging())
- qDebug() << "Guide: Guider is suspended.";
-
- return;
- }
-
- if (guider->isDithering())
- {
- pmath->performProcessing();
- if (guider->dither() == false)
- {
- appendLogText(i18n("Dithering failed. Autoguiding aborted."));
- emit newStatus(GUIDE_DITHERING_ERROR);
- guider->abort();
- //emit ditherFailed();
- }
- }
- else if (guider->isGuiding())
- {
- guider->guide();
-
- if (guider->isGuiding())
- capture();
- }
- else if (calibration->isCalibrating())
- {
- GuideDriver = ST4Driver;
- pmath->performProcessing();
- calibration->processCalibration();
-
- if (calibration->isCalibrationComplete())
- {
- guider->setReady(true);
- tabWidget->setTabEnabled(1, true);
- //emit guideReady();
- }
- }
-
- emit newStarPixmap(targetImage->getTrackingBoxPixmap());
-}
-
-void Guide::appendLogText(const QString &text)
-{
-
- logText.insert(0, i18nc("log entry; %1 is the date, %2 is the text", "%1 %2", QDateTime::currentDateTime().toString("yyyy-MM-ddThh:mm:ss"), text));
-
- if (Options::guideLogging())
- qDebug() << "Guide: " << text;
-
- emit newLog();
-}
-
-void Guide::clearLog()
-{
- logText.clear();
- emit newLog();
-}
-
-void Guide::setDECSwap(bool enable)
-{
- if (ST4Driver == NULL || guider == NULL)
- return;
-
- guider->setDECSwap(enable);
- ST4Driver->setDECSwap(enable);
-
-}
-
-bool Guide::sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs )
-{
- if (GuideDriver == NULL || (ra_dir == NO_DIR && dec_dir == NO_DIR))
- return false;
-
- if (calibration->isCalibrating())
- QTimer::singleShot( (ra_msecs > dec_msecs ? ra_msecs : dec_msecs) + 100, this, SLOT(capture()));
-
- return GuideDriver->doPulse(ra_dir, ra_msecs, dec_dir, dec_msecs);
-}
-
-bool Guide::sendPulse( GuideDirection dir, int msecs )
-{
- if (GuideDriver == NULL || dir==NO_DIR)
- return false;
-
- if (calibration->isCalibrating())
- QTimer::singleShot(msecs+100, this, SLOT(capture()));
-
- return GuideDriver->doPulse(dir, msecs);
-
-}
-
-QStringList Guide::getST4Devices()
-{
- QStringList devices;
-
- foreach(ISD::ST4* driver, ST4List)
- devices << driver->getDeviceName();
-
- return devices;
-}
-
-double Guide::getReticleAngle()
-{
- return calibration->getReticleAngle();
-}
-
-/*void Guide::viewerClosed()
-{
- pmath->set_image(NULL);
- guider->setImage(NULL);
- calibration->setImage(NULL);
-}*/
-
-void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit)
-{
- // Check if guide star is lost
- if (dx == -1 && dy == -1 && fit == -1)
- {
- KMessageBox::error(NULL, i18n("Lost track of the guide star. Rapid guide aborted."));
- guider->abort();
- return;
- }
-
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
-
- if (targetImage == NULL)
- {
- pmath->setImageView(NULL);
- guider->setImageView(NULL);
- calibration->setImageView(NULL);
- }
-
- if (rapidGuideReticleSet == false)
- {
- // Let's set reticle parameter on first capture to those of the star, then we check if there
- // is any set
- double x,y,angle;
- pmath->getReticleParameters(&x, &y, &angle);
- pmath->setReticleParameters(dx, dy, angle);
- rapidGuideReticleSet = true;
- }
-
- pmath->setRapidStarData(dx, dy);
-
- if (guider->isDithering())
- {
- pmath->performProcessing();
- if (guider->dither() == false)
- {
- appendLogText(i18n("Dithering failed. Autoguiding aborted."));
- emit newStatus(GUIDE_DITHERING_ERROR);
- guider->abort();
- //emit ditherFailed();
- }
- }
- else
- {
- guider->guide();
- capture();
- }
-
-}
-
-void Guide::startRapidGuide()
-{
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- if (currentCCD->setRapidGuide(targetChip, true) == false)
- {
- appendLogText(i18n("The CCD does not support Rapid Guiding. Aborting..."));
- guider->abort();
- return;
- }
-
- rapidGuideReticleSet = false;
-
- pmath->setRapidGuide(true);
- currentCCD->configureRapidGuide(targetChip, true);
- connect(currentCCD, SIGNAL(newGuideStarData(ISD::CCDChip*,double,double,double)), this, SLOT(processRapidStarData(ISD::CCDChip*,double,double,double)));
-
-}
-
-void Guide::stopRapidGuide()
-{
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- pmath->setRapidGuide(false);
-
- rapidGuideReticleSet = false;
-
- currentCCD->disconnect(SIGNAL(newGuideStarData(ISD::CCDChip*,double,double,double)));
-
- currentCCD->configureRapidGuide(targetChip, false, false, false);
-
- currentCCD->setRapidGuide(targetChip, false);
-
-}
-
-
-bool Guide::isDithering()
-{
- return (Options::useEkosGuider() ? guider->isDithering() : phd2->isDithering());
-}
-
-void Guide::dither()
-{
- if (Options::useEkosGuider())
- {
- if (isDithering() == false)
- guider->dither();
- }
- else
- {
- if (isDithering() == false)
- phd2->dither(guider->getDitherPixels());
- }
-
-}
-
-void Guide::updateGuideDriver(double delta_ra, double delta_dec)
-{
- guideDeviationRA = delta_ra;
- guideDeviationDEC = delta_dec;
-
- // If using PHD2 or not guiding, no need to go further on
- if (Options::usePHD2Guider() || isGuiding() == false)
- return;
-
- if (isDithering())
- {
- GuideDriver = ST4Driver;
- return;
- }
-
- // Guide via AO only if guiding deviation is below AO limit
- if (AODriver != NULL && (fabs(delta_ra) < guider->getAOLimit()) && (fabs(delta_dec) < guider->getAOLimit()))
- {
- if (AODriver != GuideDriver)
- appendLogText(i18n("Using %1 to correct for guiding errors.", AODriver->getDeviceName()));
- GuideDriver = AODriver;
- return;
- }
-
- if (GuideDriver != ST4Driver)
- appendLogText(i18n("Using %1 to correct for guiding errors.", ST4Driver->getDeviceName()));
-
- GuideDriver = ST4Driver;
-}
-
-bool Guide::isCalibrationComplete()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrationComplete();
- else
- return phd2->isCalibrationComplete();
-
-}
-
-bool Guide::isCalibrationSuccessful()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrationSuccessful();
- else
- return phd2->isCalibrationSuccessful();
-}
-
-bool Guide::startCalibration()
-{
- if (Options::useEkosGuider())
- return calibration->startCalibration();
- else
- return phd2->startGuiding();
-}
-
-bool Guide::stopCalibration()
-{
- if (Options::useEkosGuider())
- return calibration->stopCalibration();
- else
- return phd2->stopGuiding();
-}
-
-bool Guide::isCalibrating()
-{
- if (Options::useEkosGuider())
- return calibration->isCalibrating();
- else
- return phd2->isCalibrating();
-}
-
-bool Guide::isGuiding()
-{
- if (Options::useEkosGuider())
- return guider->isGuiding();
- else
- return phd2->isGuiding();
-}
-
-bool Guide::startGuiding()
-{
- // This will handle both internal and external guiders
- return guider->start();
-
- /*if (Options::useEkosGuider())
- return guider->start();
- else
- return phd2->startGuiding();*/
-}
-
-bool Guide::stopGuiding()
-{
- isSuspended=false;
-
- if (Options::useEkosGuider())
- return guider->abort(true);
- else
- // guider stop will call phd2->stopGuide() and change GUI elements accordingly
- return guider->stop();
-}
-
-void Guide::setSuspended(bool enable)
-{
- if (enable == isSuspended || (enable && isGuiding() == false))
- return;
-
- isSuspended = enable;
-
- if (isSuspended)
- {
- if (Options::usePHD2Guider())
- phd2->pauseGuiding();
- }
- else
- {
- if (Options::useEkosGuider())
- capture();
- else
- phd2->resumeGuiding();
- //phd2->startGuiding();
- }
-
- if (isSuspended)
- {
- appendLogText(i18n("Guiding suspended."));
- }
- else
- {
- appendLogText(i18n("Guiding resumed."));
- }
-}
-
-void Guide::setExposure(double value)
-{
- exposureIN->setValue(value);
-}
-
-
-void Guide::setImageFilter(const QString & value)
-{
- for (int i=0; i < filterCombo->count(); i++)
- if (filterCombo->itemText(i) == value)
- {
- filterCombo->setCurrentIndex(i);
- break;
- }
-}
-
-void Guide::setCalibrationTwoAxis(bool enable)
-{
- calibration->setCalibrationTwoAxis(enable);
-}
-
-void Guide::setCalibrationAutoStar(bool enable)
-{
- calibration->setCalibrationAutoStar(enable);
-}
-
-void Guide::setCalibrationAutoSquareSize(bool enable)
-{
- calibration->setCalibrationAutoSquareSize(enable);
-}
-
-void Guide::setCalibrationPulseDuration(int pulseDuration)
-{
- calibration->setCalibrationPulseDuration(pulseDuration);
-}
-
-void Guide::setGuideBoxSizeIndex(int boxSize)
-{
- boxSizeCombo->setCurrentIndex(boxSize);
-}
-
-void Guide::setGuideAlgorithm(const QString & algorithm)
-{
- guider->setGuideOptions(algorithm, guider->useSubFrame(), guider->useRapidGuide());
-}
-
-void Guide::setSubFrameEnabled(bool enable)
-{
- guider->setGuideOptions(guider->getAlgorithm(), enable , guider->useRapidGuide());
-}
-
-void Guide::setGuideRapid(bool enable)
-{
- guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , enable);
-}
-
-void Guide::setDither(bool enable, double value)
-{
- guider->setDither(enable, value);
-}
-
-QList<double> Guide::getGuidingDeviation()
-{
- QList<double> deviation;
-
- deviation << guideDeviationRA << guideDeviationDEC;
-
- return deviation;
-}
-
-void Guide::startAutoCalibrateGuiding()
-{
- if (Options::useEkosGuider())
- connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(checkAutoCalibrateGuiding(Ekos::GuideState)));
- else
- connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(checkAutoCalibrateGuiding(Ekos::GuideState)));
-
- startCalibration();
-}
-
-void Guide::checkAutoCalibrateGuiding(Ekos::GuideState state)
-{
- if (state < GUIDE_CALIBRATION_SUCESS || state > GUIDE_CALIBRATION_ERROR)
- return;
-
- if (Options::useEkosGuider())
- disconnect(calibration, SIGNAL(newStatus(GuideState)), this, SLOT(checkAutoCalibrateGuiding(GuideState)));
- else
- disconnect(phd2, SIGNAL(newStatus(GuideState)), this, SLOT(checkAutoCalibrateGuiding(GuideState)));
-
- if (state == GUIDE_CALIBRATION_SUCESS)
- {
- appendLogText(i18n("Auto calibration successful. Starting guiding..."));
- startGuiding();
- }
- else
- {
- appendLogText(i18n("Auto calibration failed."));
- }
-}
-
-void Guide::setStatus(Ekos::GuideState newState)
-{
- if (newState == state)
- return;
-
- state = newState;
-
- emit newStatus(newState);
-}
-
-QString Guide::getStatusString(Ekos::GuideState state)
-{
-
- switch (state)
- {
- case GUIDE_IDLE:
- return i18n("Idle");
- break;
-
- case GUIDE_CALIBRATING:
- return i18n("Calibrating");
- break;
-
- case GUIDE_CALIBRATION_SUCESS:
- return i18n("Calibration successful");
- break;
-
- case GUIDE_CALIBRATION_ERROR:
- return i18n("Calibration error");
- break;
-
- case GUIDE_GUIDING:
- return i18n("Guiding");
- break;
-
- case GUIDE_ABORTED:
- return i18n("Aborted");
- break;
-
-
- case GUIDE_SUSPENDED:
- return i18n("Suspended");
- break;
-
- case GUIDE_DITHERING:
- return i18n("Dithering");
- break;
-
- case GUIDE_DITHERING_SUCCESS:
- return i18n("Dithering successful");
- break;
-
- case GUIDE_DITHERING_ERROR:
- return i18n("Dithering error");
- break;
-
- }
-
- return i18n("Unknown");
-}
-
-void Guide::updateCCDBin(int index)
-{
- if (currentCCD == NULL && Options::usePHD2Guider())
- return;
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- targetChip->setBinning(index+1, index+1);
-
-}
-
-void Guide::processCCDNumber(INumberVectorProperty *nvp)
-{
- if (currentCCD == NULL || strcmp(nvp->device, currentCCD->getDeviceName()))
- return;
-
- if ( (!strcmp(nvp->name, "CCD_BINNING") && useGuideHead == false) || (!strcmp(nvp->name, "GUIDER_BINNING") && useGuideHead) )
- {
- binningCombo->disconnect();
- binningCombo->setCurrentIndex(nvp->np[0].value-1);
- connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
- }
-}
-
-void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState state)
-{
- INDI_UNUSED(exposure);
-
- if (state == IPS_ALERT && (guider->isGuiding() || guider->isDithering() || calibration->isCalibrating()))
- {
- appendLogText(i18n("Exposure failed. Restarting exposure..."));
- targetChip->capture(exposureIN->value());
- }
-}
-
-void Guide::setDarkFrameEnabled(bool enable)
-{
- Options::setUseGuideDarkFrame(enable);
-
- /*if (enable && calibration && calibration->useAutoStar())
- appendLogText(i18n("Warning: In auto mode, you will not be asked to cover cameras unequipped with shutters in order to capture a dark frame. The dark frame capture will proceed without warning."
- " You can capture dark frames with auto mode off and they shall be saved in the dark library for use when ever needed."));*/
-}
-
-void Guide::saveDefaultGuideExposure()
-{
- Options::setGuideExposure(exposureIN->value());
-}
-
-void Guide::setStarPosition(const QVector3D &newCenter, bool updateNow)
-{
- starCenter.setX(newCenter.x());
- starCenter.setY(newCenter.y());
- if (newCenter.z() > 0)
- starCenter.setZ(newCenter.z());
-
- if (updateNow)
- syncTrackingBoxPosition();
-
-}
-
-void Guide::syncTrackingBoxPosition()
-{
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
- Q_ASSERT(targetChip);
-
- int subBinX=1, subBinY=1;
- targetChip->getBinning(&subBinX, &subBinY);
-
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
-
- if (targetImage && starCenter.isNull() == false)
- {
- double boxSize = boxSizeCombo->currentText().toInt();
- int x,y,w,h;
- targetChip->getFrame(&x,&y,&w,&h);
- // If box size is larger than image size, set it to lower index
- if (boxSize/subBinX >= w || boxSize/subBinY >= h)
- {
- boxSizeCombo->setCurrentIndex(boxSizeCombo->currentIndex()-1);
- return;
- }
-
- // If binning changed, update coords accordingly
- if (subBinX != starCenter.z())
- {
- if (starCenter.z() > 0)
- {
- starCenter.setX(starCenter.x() * (starCenter.z()/subBinX));
- starCenter.setY(starCenter.y() * (starCenter.z()/subBinY));
- }
-
- starCenter.setZ(subBinX);
- }
-
- QRect starRect = QRect( starCenter.x()-boxSize/(2*subBinX), starCenter.y()-boxSize/(2*subBinY), boxSize/subBinX, boxSize/subBinY);
- targetImage->setTrackingBoxEnabled(true);
- targetImage->setTrackingBox(starRect);
- }
-}
-
-void Guide::updateTrackingBoxSize(int currentIndex)
-{
- Options::setGuideSquareSizeIndex(currentIndex);
-
- syncTrackingBoxPosition();
-}
-
-bool Guide::selectAutoStar()
-{
- if (currentCCD == NULL)
- return false;
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
- if (targetChip == NULL)
- return false;
-
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
- if (targetImage == NULL)
- return false;
-
- FITSData *imageData = targetImage->getImageData();
- if (imageData == NULL)
- return false;
-
- imageData->findStars();
-
- QList<Edge*> starCenters = imageData->getStarCenters();
-
- if (starCenters.empty())
- return false;
-
- qSort(starCenters.begin(), starCenters.end(), [](const Edge *a, const Edge *b){return a->width > b->width;});
-
- int maxX = imageData->getWidth();
- int maxY = imageData->getHeight();
-
- int scores[MAX_GUIDE_STARS];
-
- int maxIndex = MAX_GUIDE_STARS < starCenters.count() ? MAX_GUIDE_STARS : starCenters.count();
-
- for (int i=0; i < maxIndex; i++)
- {
- int score=100;
-
- Edge *center = starCenters.at(i);
-
- //qDebug() << "#" << i << " X: " << center->x << " Y: " << center->y << " HFR: " << center->HFR << " Width" << center->width;
-
- // Severely reject stars close to edges
- if (center->x < (center->width*5) || center->y < (center->width*5) || center->x > (maxX-center->width*5) || center->y > (maxY-center->width*5))
- score-=50;
-
- // Moderately favor brighter stars
- score += center->width*center->width;
-
- // Moderately reject stars close to other stars
- foreach(Edge *edge, starCenters)
- {
- if (edge == center)
- continue;
-
- if (abs(center->x - edge->x) < center->width*2 && abs(center->y - edge->y) < center->width*2)
- {
- score -= 15;
- break;
- }
- }
-
- scores[i] = score;
- }
-
- int maxScore=0;
- int maxScoreIndex=0;
- for (int i=0; i < maxIndex; i++)
- {
- if (scores[i] > maxScore)
- {
- maxScore = scores[i];
- maxScoreIndex = i;
- }
- }
-
- /*if (ui.autoSquareSizeCheck->isEnabled() && ui.autoSquareSizeCheck->isChecked())
- {
- // Select appropriate square size
- int idealSize = ceil(starCenters[maxScoreIndex]->width * 1.5);
-
- if (Options::guideLogging())
- qDebug() << "Guide: Ideal calibration box size for star width: " << starCenters[maxScoreIndex]->width << " is " << idealSize << " pixels";
-
- // TODO Set square size in GuideModule
- }*/
-
- QVector3D newStarCenter(starCenters[maxScoreIndex]->x, starCenters[maxScoreIndex]->y, 0);
- setStarPosition(newStarCenter, false);
-
- return true;
-}
-
}
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index e2cbcab..2e2de55 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -60,9 +60,10 @@ InternalGuider::setSquareAlgorithm(int index)
pmath->setSquareAlgorithm(index);
}
-void InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength)
+bool InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength)
{
// TODO
+ return true;
}
diff --git a/kstars/ekos/guide/internalguide/internalguider.h b/kstars/ekos/guide/internalguide/internalguider.h
index 8b011e7..10c93bc 100644
--- a/kstars/ekos/guide/internalguide/internalguider.h
+++ b/kstars/ekos/guide/internalguide/internalguider.h
@@ -12,8 +12,11 @@
#ifndef INTERNALGUIDER_H
#define INTERNALGUIDER_H
+#include "matr.h"
#include "../guideinterface.h"
+class cgmath;
+
namespace Ekos
{
@@ -28,8 +31,8 @@ public:
InternalGuider();
~InternalGuider();
- void Connect() override;
- void Disconnect() override;
+ bool Connect() override { return true; }
+ bool Disconnect() override { return true; }
bool calibrate() override;
bool guide() override;
@@ -38,7 +41,7 @@ public:
bool resume() override;
bool dither(double pixels) override;
- void setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength) override;
+ bool setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength) override;
void setSquareAlgorithm( int index );
@@ -46,13 +49,10 @@ public:
/// IMPORTED CHECK THEM ALL
- void guide( void );
bool start();
- bool stop();
bool abort(bool silence=false);
void setHalfRefreshRate( bool is_half );
bool isGuiding( void ) const;
- void setMathObject( cgmath *math );
void setAO(bool enable);
void setInterface( void );
void setImageView(FITSView *image);
@@ -64,21 +64,10 @@ public:
void setSubFramed(bool enable) { m_isSubFramed = enable;}
void setGuideOptions(const QString & algorithm, bool useSubFrame, bool useRapidGuide);
- // Dither
- bool isDitherChecked() { return ui.ditherCheck->isChecked(); }
- bool dither();
- bool isDithering() { return m_isDithering; }
- void setDither(bool enable, double value);
- double getDitherPixels() { return ui.ditherPixels->value(); }
-
- setSquareAlgorithm( index );
-
QString getAlgorithm();
bool useSubFrame();
bool useRapidGuide();
- void setPHD2(Ekos::PHD2 *phd);
-
public slots:
void setDECSwap(bool enable);
@@ -125,7 +114,6 @@ private:
bool is_started;
- calibrationparams_t calibration_params;
int axis;
int auto_drift_time;
int turn_back_time;
@@ -137,7 +125,6 @@ private:
double phi;
Matrix ROT_Z;
- cgmath *pmath;
Ekos::Guide *guideModule;
QColor idleColor, okColor, busyColor, alertColor;
@@ -145,7 +132,6 @@ private:
CalibrationStage calibrationStage;
CalibrationType calibrationType;
- QPointer<FITSView> guideFrame;
};
}
diff --git a/kstars/ekos/mount/mount.cpp b/kstars/ekos/mount/mount.cpp
index 4235b75..9949817 100644
--- a/kstars/ekos/mount/mount.cpp
+++ b/kstars/ekos/mount/mount.cpp
@@ -18,7 +18,7 @@
#include "mountadaptor.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "kstarsdata.h"
diff --git a/kstars/ekos/opsekos.cpp b/kstars/ekos/opsekos.cpp
index a5ffcd7..276ac47 100644
--- a/kstars/ekos/opsekos.cpp
+++ b/kstars/ekos/opsekos.cpp
@@ -20,7 +20,7 @@
#include "Options.h"
#include "kstarsdata.h"
#include "ekosmanager.h"
-#include "guide.h"
+#include "guide/guide.h"
#include "fov.h"
OpsEkos::OpsEkos()
@@ -31,14 +31,9 @@ OpsEkos::OpsEkos()
//Get a pointer to the KConfigDialog
m_ConfigDialog = KConfigDialog::exists( "settings" );
- selectPHD2B->setIcon(QIcon::fromTheme("document-open"));
-
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() ) );
- connect( selectPHD2B, SIGNAL(clicked()), this, SLOT(slotSelectPHD2Exec()));
- connect( kcfg_UseEkosGuider, SIGNAL(toggled(bool)), this, SLOT(slotCheckGuideModule()));
-
}
@@ -50,13 +45,6 @@ void OpsEkos::slotApply()
if (ekosManager)
{
- //ekosManager->refreshRemoteDrivers();
-
- Ekos::Guide *guideModule = ekosManager->guideModule();
-
- if (guideModule)
- guideModule->setGuiderProcess(kcfg_UseEkosGuider->isChecked() ? Ekos::Guide::GUIDE_INTERNAL : Ekos::Guide::GUIDE_PHD2);
-
Ekos::Align *alignModule = ekosManager->alignModule();
if (alignModule && alignModule->fov())
@@ -68,16 +56,8 @@ void OpsEkos::slotCancel()
{
}
-void OpsEkos::slotSelectPHD2Exec()
-{
- QUrl phd2URL = QFileDialog::getOpenFileUrl(this, i18n("Select PHD2 Executable"));
- if (phd2URL.isEmpty())
- return;
-
- kcfg_PHD2Exec->setText(phd2URL.toLocalFile());
-}
-
-void OpsEkos::slotCheckGuideModule()
+/*
+void OpsEkos::slotCheckAlignModule()
{
EkosManager *ekosManager = KStars::Instance()->ekosManager();
@@ -98,3 +78,4 @@ void OpsEkos::slotCheckGuideModule()
}
}
}
+*/
diff --git a/kstars/ekos/opsekos.h b/kstars/ekos/opsekos.h
index bc91613..cbd8c27 100644
--- a/kstars/ekos/opsekos.h
+++ b/kstars/ekos/opsekos.h
@@ -34,8 +34,7 @@ private slots:
void slotApply();
void slotCancel();
- void slotSelectPHD2Exec();
- void slotCheckGuideModule();
+ //void slotCheckAlignModule();
private:
KConfigDialog *m_ConfigDialog;
diff --git a/kstars/ekos/scheduler/mosaic.cpp b/kstars/ekos/scheduler/mosaic.cpp
index ab282af..362b41f 100644
--- a/kstars/ekos/scheduler/mosaic.cpp
+++ b/kstars/ekos/scheduler/mosaic.cpp
@@ -13,7 +13,7 @@
#include "projections/projector.h"
#include "scheduler.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "Options.h"
@@ -279,7 +279,7 @@ void Mosaic::calculateFOV()
Options::setCameraPixelWidth(pixelWSizeSpin->value());
Options::setCameraPixelHeight(pixelHSizeSpin->value());
Options::setCameraWidth(cameraWSpin->value());
- Options::setCameraHeight(cameraHSpin->value());
+ Options::setCameraHeight(cameraHSpin->value());
// Calculate FOV in arcmins
double fov_x = 206264.8062470963552 * cameraWSpin->value() * pixelWSizeSpin->value() / 60000.0 / focalLenSpin->value();
@@ -471,7 +471,7 @@ void Mosaic::constructMosaic()
if (mosaicWSpin->value() > 1 || mosaicHSpin->value() > 1)
createJobsB->setEnabled(true);
- if (mosaicTile->getWidth() != mosaicWSpin->value() || mosaicTile->getHeight() != mosaicHSpin->value() || mosaicTile->getOverlap() != overlapSpin->value() || mosaicTile->getPA() != rotationSpin->value())
+ if (mosaicTile->getWidth() != mosaicWSpin->value() || mosaicTile->getHeight() != mosaicHSpin->value() || mosaicTile->getOverlap() != overlapSpin->value() || mosaicTile->getPA() != rotationSpin->value())
{
if (mosaicTile->getPA() != rotationSpin->value())
Options::setCameraRotation(rotationSpin->value());
diff --git a/kstars/ekos/scheduler/scheduler.cpp b/kstars/ekos/scheduler/scheduler.cpp
index 57e8619..5c314f7 100644
--- a/kstars/ekos/scheduler/scheduler.cpp
+++ b/kstars/ekos/scheduler/scheduler.cpp
@@ -23,7 +23,7 @@
#include "scheduleradaptor.h"
#include "dialogs/finddialog.h"
-#include "ekosmanager.h"
+#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "scheduler.h"
#include "skymapcomposite.h"
@@ -3841,7 +3841,7 @@ bool Scheduler::estimateJobTime(SchedulerJob *job)
// Wild guess that each in sequence auto focus takes an average of 20 seconds. It can take any where from 2 seconds to 2+ minutes.
sequenceEstimatedTime += jobExposureCount * 20;
// If we're dithering after each exposure, that's another 10-20 seconds
- if (Options::useDither())
+ if (Options::ditherEnabled())
sequenceEstimatedTime += jobExposureCount * 15;
}
}
diff --git a/kstars/ekos/scheduler/scheduler.h b/kstars/ekos/scheduler/scheduler.h
index 51a31b7..eb22f8e 100644
--- a/kstars/ekos/scheduler/scheduler.h
+++ b/kstars/ekos/scheduler/scheduler.h
@@ -20,8 +20,8 @@
#include "ui_scheduler.h"
#include "scheduler.h"
#include "schedulerjob.h"
-#include "QProgressIndicator.h"
-#include "align.h"
+#include "ekos/auxiliary/QProgressIndicator.h"
+#include "ekos/align/align.h"
class KSMoon;
class GeoLocation;
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 89ab730..189dec2 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -1233,7 +1233,7 @@ sky map.</whatsthis>
<whatsthis>Log Ekos Focus Module activity.</whatsthis>
<default>false</default>
</entry>
- <entry name="Logging" type="Bool">
+ <entry name="GuideLogging" type="Bool">
<whatsthis>Log Ekos Guide Module activity.</whatsthis>
<default>false</default>
</entry>
diff --git a/kstars/org.kde.kstars.Ekos.Guide.xml b/kstars/org.kde.kstars.Ekos.Guide.xml
index 75d9916..4df5e64 100644
--- a/kstars/org.kde.kstars.Ekos.Guide.xml
+++ b/kstars/org.kde.kstars.Ekos.Guide.xml
@@ -30,17 +30,8 @@
<method name="getST4Devices">
<arg type="as" direction="out"/>
</method>
- <method name="isCalibrationComplete">
- <arg type="b" direction="out"/>
- </method>
- <method name="isCalibrationSuccessful">
- <arg type="b" direction="out"/>
- </method>
- <method name="isCalibrating">
- <arg type="b" direction="out"/>
- </method>
- <method name="isGuiding">
- <arg type="b" direction="out"/>
+ <method name="getStatus">
+ <arg type="ui" direction="out"/>
</method>
<method name="getGuidingDeviation">
<arg type="ad" direction="out"/>