Commit e90f2e55 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

More re-organization to the Ekos code base. Should be ready in a few days

parent 5b527742
......@@ -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
......
......@@ -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"
......
......@@ -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
{
......
......@@ -8,7 +8,7 @@
*/
#include "dome.h"
#include "ekosmanager.h"
#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "domeadaptor.h"
......
......@@ -8,7 +8,7 @@
*/
#include "dustcap.h"
#include "ekosmanager.h"
#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "dustcapadaptor.h"
......
......@@ -8,7 +8,7 @@
*/
#include "weather.h"
#include "ekosmanager.h"
#include "ekos/ekosmanager.h"
#include "kstars.h"
#include "weatheradaptor.h"
......
......@@ -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...";
......
......@@ -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"
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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"
......
......@@ -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
{
......
......@@ -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:
......
......@@ -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