[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kstars/bleeding] kstars: Calibration mostly works now in internal guider. Need to test all cases af
From: Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date: 2016-09-30 20:38:35
Message-ID: E1bq4Zn-00030p-9a () code ! kde ! org
[Download RAW message or body]
Git commit 29f66bff03d27e1a5b5ec958fa7cccf82ee7613c by Jasem Mutlaq.
Committed on 30/09/2016 at 20:38.
Pushed by mutlaqja into branch 'bleeding'.
Calibration mostly works now in internal guider. Need to test all cases after guiding \
and dithering are complete
M +1 -1 kstars/ekos/guide/externalguide/phd2.h
M +235 -89 kstars/ekos/guide/guide.cpp
M +37 -15 kstars/ekos/guide/guide.h
M +48 -29 kstars/ekos/guide/guide.ui
M +5 -0 kstars/ekos/guide/guideinterface.cpp
M +3 -1 kstars/ekos/guide/guideinterface.h
M +16 -26 kstars/ekos/guide/internalguide/gmath.cpp
M +4 -7 kstars/ekos/guide/internalguide/gmath.h
M +146 -287 kstars/ekos/guide/internalguide/internalguider.cpp
M +24 -11 kstars/ekos/guide/internalguide/internalguider.h
M +1 -6 kstars/ekos/guide/opscalibration.cpp
M +0 -1 kstars/ekos/guide/opscalibration.h
M +19 -22 kstars/ekos/guide/opscalibration.ui
M +1 -5 kstars/kstars.kcfg
M +3 -6 kstars/org.kde.kstars.Ekos.Guide.xml
http://commits.kde.org/kstars/29f66bff03d27e1a5b5ec958fa7cccf82ee7613c
diff --git a/kstars/ekos/guide/externalguide/phd2.h \
b/kstars/ekos/guide/externalguide/phd2.h index 90b2a37..a36c100 100644
--- a/kstars/ekos/guide/externalguide/phd2.h
+++ b/kstars/ekos/guide/externalguide/phd2.h
@@ -47,7 +47,7 @@ public:
bool calibrate() override;
bool guide() override;
- bool stop() override;
+ bool abort() override;
bool suspend() override;
bool resume() override;
bool dither(double pixels) override;
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index f4fb24f..ab8f8bc 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -37,6 +37,7 @@
#include "guideadaptor.h"
#include "kspaths.h"
+#include "kstarsdata.h"
#define driftGraph_WIDTH 200
#define driftGraph_HEIGHT 200
@@ -63,15 +64,37 @@ Guide::Guide() : QWidget()
// ST4 Driver
GuideDriver=NULL;
+ // Auto Star
+ autoStarCaptured = false;
+
+ guideView = new FITSView(guideWidget);
+ guideView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ guideView->setBaseSize(guideWidget->size());
+ QVBoxLayout *vlayout = new QVBoxLayout();
+ vlayout->addWidget(guideView);
+ guideWidget->setLayout(vlayout);
+ connect(guideView, SIGNAL(trackingStarSelected(int,int)), this, \
SLOT(setTrackingStar(int,int))); +
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
guideDeviationRA = guideDeviationDEC = 0;
useGuideHead = false;
- rapidGuideReticleSet = false;
+ rapidGuideReticleSet = false;
// Load all settings
loadSettings();
+ // Set color scheme
+ refreshColorScheme();
+
+ // Image Filters
+ foreach(QString filter, FITSViewer::filterTypes)
+ filterCombo->addItem(filter);
+
+ // Progress Indicator
+ pi = new QProgressIndicator(this);
+ controlLayout->addWidget(pi, 0, 1, 1, 1);
+
// Exposure
connect(exposureIN, SIGNAL(editingFinished()), this, \
SLOT(saveDefaultGuideExposure()));
@@ -96,7 +119,7 @@ Guide::Guide() : QWidget()
// Drift Graph scales
connect( spinBox_XScale, SIGNAL(valueChanged(int)), this, \
SLOT(onXscaleChanged(int)) );
- connect( spinBox_YScale, SIGNAL(valueChanged(int)), this, \
SLOT(onYscaleChanged(int)) ); + connect( spinBox_YScale, \
SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
// Guiding Rate - Advisory only
connect( spinBox_GuideRate, SIGNAL(valueChanged(double)), this, \
SLOT(onInfoRateChanged(double)) ); @@ -134,13 +157,14 @@ Guide::Guide() : QWidget()
connect( spinBox_MinPulseRA, SIGNAL(editingFinished()), this, \
SLOT(onInputParamChanged()) );
connect( spinBox_MinPulseDEC, SIGNAL(editingFinished()), this, \
SLOT(onInputParamChanged()) );
- // Image Filters
- foreach(QString filter, FITSViewer::filterTypes)
- filterCombo->addItem(filter);
+ // Capture
+ connect(captureB, SIGNAL(clicked()), this, SLOT(capture()));
- // Progress Indicator
- pi = new QProgressIndicator(this);
- controlLayout->addWidget(pi, 0, 1, 1, 1);
+ // Stop
+ connect(stopB, SIGNAL(clicked()), this, SLOT(abort()));
+
+ // Calibrate
+ connect(calibrateB, SIGNAL(clicked()), this, SLOT(calibrate()));
// Drift Graph
//driftGraph = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
@@ -158,15 +182,23 @@ Guide::Guide() : QWidget()
case GUIDE_INTERNAL:
{
guider= new InternalGuider();
+ InternalGuider *internalGuider = dynamic_cast<InternalGuider*>(guider);
// Options
KConfigDialog* dialog = new KConfigDialog(this, "guidesettings", \
Options::self());
- opsCalibration = new OpsCalibration(dynamic_cast<InternalGuider*>(guider));
+ opsCalibration = new OpsCalibration(internalGuider);
dialog->addPage(opsCalibration, i18n("Calibration Settings"));
- opsGuide = new OpsGuide(dynamic_cast<InternalGuider*>(guider));
+ opsGuide = new OpsGuide(internalGuider);
dialog->addPage(opsGuide, i18n("Guide Settings"));
connect(guideOptionsB, SIGNAL(clicked()), dialog, SLOT(show()));
- calibrationB->setEnabled(true);
+ connect(internalGuider, SIGNAL(newPulse(GuideDirection,int)), this, \
SLOT(sendPulse(GuideDirection,int))); + connect(internalGuider, \
SIGNAL(newPulse(GuideDirection,int,GuideDirection,int)), this, \
SLOT(sendPulse(GuideDirection,int,GuideDirection,int))); + \
connect(internalGuider, SIGNAL(DESwapChanged(bool)), swapCheck, \
SLOT(setChecked(bool))); + //connect(swapCheck, SIGNAL(toggled(bool)), \
internalGuider, SLOT(setDECSwap(bool))); +
+ internalGuider->setGuideView(guideView);
+
+ calibrateB->setEnabled(true);
captureB->setEnabled(true);
}
break;
@@ -177,7 +209,7 @@ Guide::Guide() : QWidget()
// Do NOT receive BLOBs from the driver
//currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, \
currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
- calibrationB->setEnabled(false);
+ calibrateB->setEnabled(false);
captureB->setEnabled(false);
break;
@@ -187,7 +219,7 @@ Guide::Guide() : QWidget()
// Do NOT receive BLOBs from the driver
//currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, \
currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
- calibrationB->setEnabled(false);
+ calibrateB->setEnabled(false);
captureB->setEnabled(false);
break;
}
@@ -195,6 +227,8 @@ Guide::Guide() : QWidget()
state = GUIDE_IDLE;
+ connect(guider, SIGNAL(frameCaptureRequested()), this, SLOT(capture()));
+ connect(guider, SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
connect(guider, SIGNAL(newStatus(Ekos::GuideState)), this, \
SLOT(setStatus(Ekos::GuideState)));
connect(guider, SIGNAL(newStarPosition(QVector3D,bool)), this, \
SLOT(setStarPosition(QVector3D,bool)));
@@ -305,6 +339,9 @@ void Guide::checkCCD(int ccdNum)
else
useGuideHead=false;
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? \
ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD); + \
targetChip->setImageView(guideView, FITS_GUIDE); +
syncCCDInfo();
}
}
@@ -522,7 +559,7 @@ void Guide::setAO(ISD::ST4 *newAO)
bool Guide::capture()
{
if (currentCCD == NULL)
- return false;
+ return false;
double seqExpose = exposureIN->value();
@@ -581,12 +618,78 @@ bool Guide::capture()
break;
}
+ guideView->setBaseSize(guideWidget->size());
+
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
targetChip->capture(seqExpose);
+ setBusy(true);
+
+ return true;
+}
+
+bool Guide::abort()
+{
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? \
ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD); +
+ setBusy(false);
+
+ switch (state)
+ {
+ case GUIDE_IDLE:
+ case GUIDE_CONNECTED:
+ case GUIDE_DISCONNECTED:
+ if (targetChip->isCapturing())
+ targetChip->abortExposure();
+ break;
+
+ case GUIDE_CALIBRATING:
+ case GUIDE_CALIBRATION_STAR:
+ case GUIDE_CALIBRATION_CAPTURE:
+ guider->abort();
+ default:
+ break;
+
+ }
+
+
+ // Maybe set this above?
+ if (state >= GUIDE_CALIBRATING)
+ state = GUIDE_ABORTED;
+ else
+ state = GUIDE_IDLE;
+
+ emit newStatus(state);
+
return true;
}
+void Guide::setBusy(bool enable)
+{
+ if (enable)
+ {
+ calibrateB->setEnabled(false);
+ guideB->setEnabled(false);
+ captureB->setEnabled(false);
+
+ stopB->setEnabled(true);
+
+ pi->startAnimation();
+ }
+ else
+ {
+ calibrateB->setEnabled(true);
+ captureB->setEnabled(true);
+
+ if (state >= GUIDE_CALIBRATION_SUCESS)
+ guideB->setEnabled(true);
+
+ stopB->setEnabled(false);
+
+ pi->stopAnimation();
+ }
+}
+
void Guide::newFITS(IBLOB *bp)
{
INDI_UNUSED(bp);
@@ -606,7 +709,7 @@ void Guide::newFITS(IBLOB *bp)
targetChip->getFrame(&x,&y,&w,&h);
targetChip->getBinning(&binx,&biny);
- FITSView *currentImage = targetChip->getImage(FITS_GUIDE);
+ FITSView *currentImage = targetChip->getImageView(FITS_GUIDE);
FITSData *darkData = NULL;
uint16_t offsetX = x / binx;
uint16_t offsetY = y / biny;
@@ -633,13 +736,11 @@ void Guide::newFITS(IBLOB *bp)
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);
+ FITSView *targetImage = targetChip->getImageView(FITS_GUIDE);
if (targetImage == NULL)
{
@@ -653,23 +754,19 @@ void Guide::setCaptureComplete()
if (Options::guideLogging())
qDebug() << "Guide: received guide frame.";
- FITSData *image_data = targetImage->getImageData();
- Q_ASSERT(image_data);
-
- // FIXME
- /*
+ //FITSData *image_data = targetImage->getImageData();
+ //Q_ASSERT(image_data);
-
- pmath->setImageView(targetImage);
- guider->setImageView(targetImage);
+ //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 (calibration->setImageView(targetImage) == false)
+ // return;
if (starCenter.x() == 0 && starCenter.y() == 0)
{
@@ -683,7 +780,54 @@ void Guide::setCaptureComplete()
syncTrackingBoxPosition();
- if (isSuspended)
+ switch (state)
+ {
+ case GUIDE_IDLE:
+ case GUIDE_ABORTED:
+ case GUIDE_CONNECTED:
+ case GUIDE_DISCONNECTED:
+ case GUIDE_CALIBRATION_SUCESS:
+ case GUIDE_CALIBRATION_ERROR:
+ setBusy(false);
+ break;
+
+ case GUIDE_CALIBRATION_CAPTURE:
+ {
+ if (Options::autoStarEnabled())
+ {
+ autoStarCaptured = selectAutoStar();
+ if (autoStarCaptured)
+ {
+ appendLogText(i18n("Auto star selected. Starting \
calibration...")); + guider->setStarPosition(starCenter);
+ guider->calibrate();
+ }
+ else
+ {
+ appendLogText(i18n("Failed to select an auto star."));
+ state = GUIDE_CALIBRATION_ERROR;
+ emit newStatus(state);
+ setBusy(false);
+ }
+ }
+ else
+ {
+ appendLogText(i18n("Select a guide star to calibrate."));
+ state = GUIDE_CALIBRATION_STAR;
+ emit newStatus(state);
+ }
+ }
+ break;
+ case GUIDE_CALIBRATING:
+ guider->calibrate();
+ break;
+
+ default:
+ break;
+
+ }
+
+ /*if (isSuspended)
{
if (Options::guideLogging())
qDebug() << "Guide: Guider is suspended.";
@@ -750,12 +894,11 @@ void Guide::setDECSwap(bool enable)
if (ST4Driver == NULL || guider == NULL)
return;
- // FIXME
- /*
- guider->setDECSwap(enable);
- ST4Driver->setDECSwap(enable);
- */
-
+ if (guiderType == GUIDE_INTERNAL)
+ {
+ dynamic_cast<InternalGuider*>(guider)->setDECSwap(enable);
+ ST4Driver->setDECSwap(enable);
+ }
}
bool Guide::sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, \
int dec_msecs ) @@ -764,11 +907,8 @@ bool Guide::sendPulse( GuideDirection ra_dir, \
int ra_msecs, GuideDirection dec_d if (GuideDriver == NULL || (ra_dir == NO_DIR && \
dec_dir == NO_DIR)) return false;
- // FIXME
- /*
- if (calibration->isCalibrating())
+ if (state == GUIDE_CALIBRATING)
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);
}
@@ -778,11 +918,8 @@ bool Guide::sendPulse( GuideDirection dir, int msecs )
if (GuideDriver == NULL || dir==NO_DIR)
return false;
- // FIXME
- /*
- if (calibration->isCalibrating())
+ if (state == GUIDE_CALIBRATING)
QTimer::singleShot(msecs+100, this, SLOT(capture()));
- */
return GuideDriver->doPulse(dir, msecs);
@@ -958,34 +1095,28 @@ void Guide::updateGuideDriver(double delta_ra, double \
delta_dec)
*/
}
-bool Guide::startCalibration()
+bool Guide::calibrate()
{
saveSettings();
- // FIXME
- /*
- if (Options::useEkosGuider())
- return calibration->startCalibration();
- else
- return phd2->startGuiding();
+ autoStarCaptured = false;
- */
-
- return true;
-}
+ if (starCenter.isNull() || Options::autoStarEnabled())
+ {
+ state = GUIDE_CALIBRATION_CAPTURE;
+ emit newStatus(state);
-bool Guide::stopCalibration()
-{
- // FIXME
- /*
- if (Options::useEkosGuider())
- return calibration->stopCalibration();
- else
- return phd2->stopGuiding();
+ appendLogText(i18n("Capturing image..."));
+ capture();
+ return true;
+ }
- */
+ guider->setStarPosition(starCenter);
+ bool rc = guider->calibrate();
+ if (rc)
+ setBusy(true);
- return true;
+ return rc;
}
bool Guide::startGuiding()
@@ -1008,22 +1139,6 @@ bool Guide::startGuiding()
}
-bool Guide::stopGuiding()
-{
- // FIXME
- /*
- isSuspended=false;
-
- if (Options::useEkosGuider())
- return guider->abort(true);
- else
- // guider stop will call phd2->stopGuide() and change GUI elements \
accordingly
- return guider->stop();
- */
-
- return true;
-}
-
void Guide::setSuspended(bool enable)
{
/*
@@ -1108,7 +1223,7 @@ void Guide::setSubFrameEnabled(bool enable)
//guider->setGuideOptions(guider->getAlgorithm(), enable , \
guider->useRapidGuide()); }
-void Guide::setGuideRapid(bool enable)
+void Guide::setGuideRapidEnabled(bool enable)
{
//guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , \
enable); }
@@ -1172,6 +1287,20 @@ void Guide::setStatus(Ekos::GuideState newState)
state = newState;
+ switch (state)
+ {
+ case GUIDE_CALIBRATION_SUCESS:
+ setBusy(false);
+ break;
+
+ case GUIDE_CALIBRATION_ERROR:
+ setBusy(false);
+ break;
+
+ default:
+ break;
+ }
+
emit newStatus(newState);
}
@@ -1251,11 +1380,9 @@ void Guide::syncTrackingBoxPosition()
Q_ASSERT(targetChip);
int subBinX=1, subBinY=1;
- targetChip->getBinning(&subBinX, &subBinY);
-
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
+ targetChip->getBinning(&subBinX, &subBinY);
- if (targetImage && starCenter.isNull() == false)
+ if (starCenter.isNull() == false)
{
double boxSize = boxSizeCombo->currentText().toInt();
int x,y,w,h;
@@ -1280,8 +1407,8 @@ void Guide::syncTrackingBoxPosition()
}
QRect starRect = QRect( starCenter.x()-boxSize/(2*subBinX), \
starCenter.y()-boxSize/(2*subBinY), boxSize/subBinX, \
boxSize/subBinY);
- targetImage->setTrackingBoxEnabled(true);
- targetImage->setTrackingBox(starRect);
+ guideView->setTrackingBoxEnabled(true);
+ guideView->setTrackingBox(starRect);
}
}
@@ -1307,7 +1434,7 @@ bool Guide::selectAutoStar()
if (targetChip == NULL)
return false;
- FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
+ FITSView *targetImage = targetChip->getImageView(FITS_GUIDE);
if (targetImage == NULL)
return false;
@@ -1560,7 +1687,7 @@ void Guide::loadSettings()
spinBox_MaxPulseDEC->setValue(Options::dECMaximumPulse());
// Min Pulse Duration (ms)
spinBox_MinPulseRA->setValue(Options::rAMinimumPulse());
- spinBox_MinPulseDEC->setValue(Options::dECMinimumPulse());
+ spinBox_MinPulseDEC->setValue(Options::dECMinimumPulse());
}
void Guide::saveSettings()
@@ -1597,6 +1724,25 @@ void Guide::saveSettings()
Options::setDECMinimumPulse(spinBox_MinPulseDEC->value());
}
+void Guide::refreshColorScheme()
+{
+ // Drift color legend
+ RADriftLabel->setStyleSheet(QString("background-color: \
%1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("RAGuideError").name(QColor::HexRgb)));
+ DEDriftLabel->setStyleSheet(QString("background-color: \
%1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("DEGuideError").name(QColor::HexRgb)));
+}
+
+void Guide::setTrackingStar(int x, int y)
+{
+ QVector3D newStarPosition(x,y, -1);
+ setStarPosition(newStarPosition, true);
+
+ if (state == GUIDE_CALIBRATION_STAR)
+ {
+ guider->setStarPosition(newStarPosition);
+ guider->calibrate();
+ }
+}
+
}
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 77910cf..68dfa13 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -27,7 +27,7 @@
#include "ui_guide.h"
class QTabWidget;
-class FITSData;
+class FITSView;
class ScrollGraph;
class QProgressIndicator;
@@ -158,7 +158,7 @@ public:
* Set rapid guiding option. The options must be set before starting the guiding \
operation. If no options are set, the options loaded from the user configuration are \
used.
* @param enable if true, it will activate RapidGuide in the CCD driver. When \
Rapid Guide is used, no frames are sent to Ekos for analysis and the centeroid \
calculations are done in the CCD driver.
*/
- Q_SCRIPTABLE Q_NOREPLY void setGuideRapid(bool enable);
+ Q_SCRIPTABLE Q_NOREPLY void setGuideRapidEnabled(bool enable);
/** DBUS interface function.
* Enable or disables dithering
@@ -190,9 +190,7 @@ public:
void clearLog();
- void setDECSwap(bool enable);
- bool sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int \
dec_msecs );
- bool sendPulse( GuideDirection dir, int msecs );
+ void setDECSwap(bool enable);
QString getLogText() { return logText.join("\n"); }
@@ -205,6 +203,11 @@ public:
void startRapidGuide();
void stopRapidGuide();
+ /**
+ * @brief refreshColorScheme Update any colors that depend on updates in the \
color scheme + */
+ void refreshColorScheme();
+
GuideInterface * getGuider() { return guider;}
public slots:
@@ -216,22 +219,16 @@ public slots:
Q_SCRIPTABLE bool startGuiding();
/** DBUS interface function.
- * Stop the autoguiding operation.
- * @return Returns true if guiding stopped successfully, false otherwise.
+ * Stop any active calibration, guiding, or dithering operation
+ * @return Returns true if operation is stopped successfully, false otherwise.
*/
- Q_SCRIPTABLE bool stopGuiding();
+ Q_SCRIPTABLE bool abort();
/** DBUS interface function.
* Start the calibration operation.
* @return Returns true if calibration started successfully, false otherwise.
*/
- Q_SCRIPTABLE bool startCalibration();
-
- /** DBUS interface function.
- * Stop the calibration operation.
- * @return Returns true if calibration stopped successfully, false otherwise.
- */
- Q_SCRIPTABLE bool stopCalibration();
+ Q_SCRIPTABLE bool calibrate();
/** DBUS interface function.
* Capture a guide frame
@@ -259,8 +256,10 @@ public slots:
void dither();
void setSuspended(bool enable);
+ // Append Log entry
void appendLogText(const QString &);
+ // Update Guide module status
void setStatus(Ekos::GuideState newState);
// Star Position
@@ -269,6 +268,10 @@ public slots:
// Capture
void setCaptureComplete();
+ // Send pulse to ST4 driver
+ bool sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, \
int dec_msecs ); + bool sendPulse( GuideDirection dir, int msecs );
+
protected slots:
void updateCCDBin(int index);
@@ -278,6 +281,13 @@ protected slots:
*/
void processCCDNumber(INumberVectorProperty *nvp);
+ /**
+ * @brief setTrackingStar Gets called when the user select a star in the guide \
frame + * @param x X coordinate of star
+ * @param y Y coordinate of star
+ */
+ void setTrackingStar(int x, int y);
+
void saveDefaultGuideExposure();
void updateTrackingBoxSize(int currentIndex);
@@ -328,6 +338,12 @@ private:
*/
void saveSettings();
+ /**
+ * @brief setBusy Indicate busy status within the module visually
+ * @param enable True if module is busy, false otherwise
+ */
+ void setBusy(bool enable);
+
// Devices
ISD::CCD *currentCCD;
ISD::Telescope *currentTelescope;
@@ -371,6 +387,12 @@ private:
OpsCalibration *opsCalibration;
OpsGuide *opsGuide;
+ // Guide Frame
+ FITSView *guideView;
+
+ // Auto star operation
+ bool autoStarCaptured;
+
};
}
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index 03d12a1..8f44f58 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>702</width>
- <height>515</height>
+ <width>697</width>
+ <height>510</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -42,6 +42,21 @@
<string>Control</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
<item>
<layout class="QGridLayout" name="controlLayout">
<property name="spacing">
@@ -55,7 +70,7 @@
</widget>
</item>
<item row="2" column="0">
- <widget class="QPushButton" name="calibrationB">
+ <widget class="QPushButton" name="calibrateB">
<property name="enabled">
<bool>true</bool>
</property>
@@ -115,9 +130,12 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout_6">
- <property name="spacing">
+ <property name="horizontalSpacing">
<number>1</number>
</property>
+ <property name="verticalSpacing">
+ <number>5</number>
+ </property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -586,32 +604,19 @@
<item>
<layout class="QVBoxLayout" name="rightLayout">
<item>
- <widget class="FITSView" name="guideView">
+ <widget class="QWidget" name="guideWidget" native="true">
<property name="minimumSize">
<size>
<width>320</width>
<height>240</height>
</size>
</property>
- <property name="styleSheet">
- <string notr="true">background-color:gray;</string>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
+ <property name="sizeIncrement">
+ <size>
+ <width>40</width>
+ <height>30</height>
+ </size>
</property>
- <widget class="QWidget" name="scrollAreaWidgetContents_2">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>462</width>
- <height>238</height>
- </rect>
- </property>
- </widget>
</widget>
</item>
<item>
@@ -714,6 +719,9 @@
<height>16</height>
</size>
</property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
<property name="text">
<string/>
</property>
@@ -733,6 +741,13 @@
</widget>
</item>
<item>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="DEDriftLabel">
<property name="minimumSize">
<size>
@@ -746,6 +761,9 @@
<height>16</height>
</size>
</property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
<property name="text">
<string/>
</property>
@@ -765,6 +783,13 @@
</widget>
</item>
<item>
+ <widget class="Line" name="line_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="l_1">
<property name="text">
<string>X</string>
@@ -1157,12 +1182,6 @@
</widget>
<customwidgets>
<customwidget>
- <class>FITSView</class>
- <extends>QScrollArea</extends>
- <header>fitsviewer/fitsview.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
<class>ScrollGraph</class>
<extends>QWidget</extends>
<header>ekos/guide/scroll_graph.h</header>
diff --git a/kstars/ekos/guide/guideinterface.cpp \
b/kstars/ekos/guide/guideinterface.cpp index ff819aa..edcbaa1 100644
--- a/kstars/ekos/guide/guideinterface.cpp
+++ b/kstars/ekos/guide/guideinterface.cpp
@@ -95,6 +95,11 @@ bool GuideInterface::getFrameParams(uint16_t *x, uint16_t *y, \
uint16_t *w, uint1 return true;
}
+void GuideInterface::setStarPosition(QVector3D starCenter)
+{
+ INDI_UNUSED(starCenter);
+}
+
}
diff --git a/kstars/ekos/guide/guideinterface.h b/kstars/ekos/guide/guideinterface.h
index d5082dd..f8ca60a 100644
--- a/kstars/ekos/guide/guideinterface.h
+++ b/kstars/ekos/guide/guideinterface.h
@@ -38,7 +38,7 @@ public:
virtual bool guide() = 0;
virtual bool suspend() = 0;
virtual bool resume() = 0;
- virtual bool stop() = 0;
+ virtual bool abort() = 0;
virtual bool dither(double pixels) = 0;
virtual bool setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double \
mountAperture, double mountFocalLength); @@ -47,6 +47,8 @@ public:
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);
+ virtual void setStarPosition(QVector3D starCenter);
+
signals:
void newLog(const QString &);
void newStatus(Ekos::GuideState);
diff --git a/kstars/ekos/guide/internalguide/gmath.cpp \
b/kstars/ekos/guide/internalguide/gmath.cpp index e6773ae..debe3a5 100644
--- a/kstars/ekos/guide/internalguide/gmath.cpp
+++ b/kstars/ekos/guide/internalguide/gmath.cpp
@@ -53,8 +53,7 @@ typedef struct
cgmath::cgmath() : QObject()
{
// sys...
- ticks = 0;
- pdata = NULL;
+ ticks = 0;
video_width = -1;
video_height = -1;
ccd_pixel_width = 0;
@@ -123,38 +122,18 @@ bool cgmath::setVideoParameters( int vid_wd, int vid_ht )
return true;
}
-void cgmath::setDataBuffer(float *buffer)
-{
- pdata = buffer;
-}
-
-void cgmath::setImageView(FITSView *image)
+void cgmath::setGuideView(FITSView *image)
{
guideView = image;
- if (guideView)
+ /*if (guideView)
{
FITSData *image_data = guideView->getImageData();
setDataBuffer(image_data->getImageBuffer());
setVideoParameters(image_data->getWidth(), image_data->getHeight());
- }
-}
-
-float *cgmath::getDataBuffer( int *width, int *height, int *length, int *size )
-{
- if( width )
- *width = video_width;
- if( height )
- *height = video_height;
- if( length )
- *length = video_width * video_height;
- if( size )
- *size = video_width * video_height * sizeof(float);
-
- return pdata;
+ }*/
}
-
bool cgmath::setGuiderParameters( double ccd_pix_wd, double ccd_pix_ht, double \
guider_aperture, double guider_focal ) {
if( ccd_pix_wd < 0 )
@@ -215,7 +194,8 @@ bool cgmath::getReticleParameters( double *x, double *y, double \
*ang ) const
*x = reticle_pos.x;
*y = reticle_pos.y;
- *ang = reticle_angle;
+ if (ang)
+ *ang = reticle_angle;
return true;
}
@@ -573,6 +553,16 @@ Vector cgmath::findLocalStarPosition( void ) const
if (trackingBox.isValid() == false)
return Vector(-1,-1,-1);
+ FITSData *imageData = guideView->getImageData();
+ if (imageData == NULL)
+ {
+ if (Options::guideLogging())
+ qDebug() << "Guide: Cannot process a NULL image.";
+ return Vector(-1,-1,-1);
+ }
+
+ float *pdata = imageData->getImageBuffer();
+
if (Options::guideLogging())
qDebug() << "Guide: Tracking Square " << trackingBox;
diff --git a/kstars/ekos/guide/internalguide/gmath.h \
b/kstars/ekos/guide/internalguide/gmath.h index e4cf01e..6574349 100644
--- a/kstars/ekos/guide/internalguide/gmath.h
+++ b/kstars/ekos/guide/internalguide/gmath.h
@@ -109,8 +109,7 @@ public:
virtual ~cgmath();
// functions
- bool setVideoParameters( int vid_wd, int vid_ht );
- float *getDataBuffer( int *width, int *height, int *length, int *size );
+ bool setVideoParameters( int vid_wd, int vid_ht );
bool setGuiderParameters( double ccd_pix_wd, double ccd_pix_ht, double \
guider_aperture, double guider_focal );
void getGuiderParameters( double *ccd_pix_wd, double *ccd_pix_ht, double \
*guider_aperture, double *guider_focal ); bool setReticleParameters( double x, \
double y, double ang ); @@ -127,11 +126,10 @@ public:
info_params_t getInfoParameters( void ) const;
uint32_t getTicks( void ) const;
- void setDataBuffer(float *buffer);
- void setImageView(FITSView *image);
+ void setGuideView(FITSView *image);
bool declinationSwapEnabled() { return dec_swap;}
void setDeclinationSwapEnabled(bool enable) { dec_swap = enable;}
- FITSView *getImageView() { return guideView; }
+ FITSView *getGuideView() { return guideView; }
void setPreviewMode(bool enable) { preview_mode = enable;}
/*void moveSquare( double newx, double newy );
@@ -176,8 +174,7 @@ signals:
private:
// sys...
- uint32_t ticks; // global channel ticker
- float *pdata; // pointer to data buffer
+ uint32_t ticks; // global channel ticker
QPointer<FITSView> guideView; // pointer to image
int video_width, video_height; // video frame dimensions
double ccd_pixel_width, ccd_pixel_height, aperture, focal;
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp \
b/kstars/ekos/guide/internalguide/internalguider.cpp index 6517618..2f93446 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -10,6 +10,7 @@
*/
#include <KMessageBox>
+#include <KNotification>
#include "internalguider.h"
#include "gmath.h"
@@ -29,10 +30,11 @@ InternalGuider::InternalGuider()
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))); + //connect(pmath, \
SIGNAL(newStarPosition(QVector3D,bool)), this, \
SLOT(setStarPosition(QVector3D,bool))); + connect(pmath, \
SIGNAL(newStarPosition(QVector3D,bool)), this, \
SIGNAL(newStarPosition(QVector3D,bool)));
// Calibration
- calibrationStage = CAL_CAPTURE_IMAGE;
+ calibrationStage = CAL_IDLE;
is_started = false;
axis = GUIDE_RA;
@@ -47,10 +49,6 @@ InternalGuider::InternalGuider()
okColor = Qt::green;
busyColor = Qt::yellow;
alertColor = Qt::red;
-
-
-
-
}
InternalGuider::~InternalGuider()
@@ -62,9 +60,10 @@ bool InternalGuider::guide()
return false;
}
-bool InternalGuider::stop()
+bool InternalGuider::abort()
{
-return false;
+ calibrationStage = CAL_IDLE;
+ return true;
}
bool InternalGuider::suspend()
@@ -99,46 +98,33 @@ bool InternalGuider::getReticleParameters(double *x, double *y, \
double *angle)
bool InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, \
double mountAperture, double mountFocalLength) {
- // TODO
- return true;
+ this->ccdPixelSizeX = ccdPixelSizeX;
+ this->ccdPixelSizeY = ccdPixelSizeY;
+ this->mountAperture = mountAperture;
+ this->mountFocalLength = mountFocalLength;
+ return pmath->setGuiderParameters(ccdPixelSizeX, ccdPixelSizeY, mountAperture, \
mountFocalLength); }
-
-bool InternalGuider::calibrate()
+bool InternalGuider::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;
- //FIXME
-
-#if 0
- /* // Capture final image
- if (calibrationType == CAL_MANUAL && calibrationStage == CAL_START)
- {
- guideModule->capture();
- return;
- }
-
- if (calibrationStage > CAL_START)
- {
- stopCalibration();
- return;
- }
-
- startCalibration();*/
+ subX = x;
+ subY = y;
+ subW = w;
+ subH = h;
+ subBinX = binX;
+ subBinY = binY;
- /*if (guideModule->isGuiding())
- {
- guideModule->appendLogText(i18n("Cannot calibrate while autoguiding is \
active."));
- return false;
- }*/
+ pmath->setVideoParameters(w, h);
- if (calibrationStage != CAL_START && Options::autoStarEnabled())
- {
- calibrationStage = CAL_CAPTURE_IMAGE;
- emit frameCaptureRequested();
- return true;
- }
+ return true;
+}
+bool InternalGuider::calibrate()
+{
bool ccdInfo=true, scopeInfo=true;
QString errMsg;
@@ -159,57 +145,68 @@ bool InternalGuider::calibrate()
if (ccdInfo == false || scopeInfo == false)
{
- KMessageBox::error(this, i18n("%1 info are missing. Please set the values in \
INDI Control Panel.", errMsg)); + KMessageBox::error(NULL, i18n("Missing \
Information"), i18n("%1 info are missing. Please set the values in INDI Control \
Panel.", errMsg)); return false;
}
- disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, \
SLOT(trackingStarSelected(int, int))); + if (state != GUIDE_CALIBRATING)
+ {
+ calibrationStage = CAL_IDLE;
+ state = GUIDE_CALIBRATING;
+ emit newStatus(GUIDE_CALIBRATING);
+ }
+ // Capture final image
+
+ // FIXME check how to do manual
+ // and fucking document it
+ /*
+ if (calibrationType == CAL_MANUAL && calibrationStage == CAL_START)
+ {
+ calibrationStage = CAL_CAPTURE_IMAGE;
+ emit frameCaptureRequested();
+ return;
+ }*/
- calibrationStage = CAL_START;
- emit newStatus(Ekos::GUIDE_CALIBRATING);
- // Must reset dec swap before we run any calibration procedure!
+ //startCalibration();
- // FIXME
- //guideModule->setDECSwap(false);
- //pmath->setDeclinationSwapEnabled(false);
- pmath->setLostStar(false);
- //pmain_wnd->capture();
+ /*if (guideModule->isGuiding())
+ {
+ guideModule->appendLogText(i18n("Cannot calibrate while autoguiding is \
active.")); + return false;
+ }*/
- // FIXME
- /*Options::setCalibrationPulseDuration(ui.spinBox_Pulse->value());
- Options::setUseAutoMode(ui.autoModeCheck->isChecked());
- Options::setUseTwoAxis(ui.twoAxisCheck->isChecked());
- Options::setAutoModeIterations(ui.spinBox_DriftTime->value());
- Options::setAutoStar(ui.autoStarCheck->isChecked());
- if (ui.autoStarCheck->isChecked())
- Options::setAutoSquareSize(ui.autoSquareSizeCheck->isChecked());
- */
-
- // manual
- if( ui.autoModeCheck->checkState() != Qt::Checked )
+ if (calibrationStage > CAL_START)
{
- calibrateManualReticle();
+ //abort();
+ processCalibration();
return true;
}
- ui.progressBar->setVisible(true);
+ disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, \
SLOT(trackingStarSelected(int, int))); +
+ // Must reset dec swap before we run any calibration procedure!
+
+ emit DESwapChanged(false);
+ pmath->setDeclinationSwapEnabled(false);
+ pmath->setLostStar(false);
+ //pmain_wnd->capture();
+
+ calibrationStage = CAL_START;
+
// automatic
- if( ui.twoAxisCheck->checkState() == Qt::Checked )
+ // If two axies (RA/DEC) are required
+ if( Options::twoAxisEnabled() )
calibrateRADECRecticle(false);
else
+ // Just RA
calibrateRADECRecticle(true);
-
- #endif
return true;
-
-
-
}
bool InternalGuider::stopCalibration()
@@ -233,22 +230,22 @@ return true;
void InternalGuider::processCalibration()
{
-
- //FIXME
-
-#if 0
//if (pmath->get_image())
//guide_frame->setTrackingBox(QRect(pmath-> square_pos.x, square_pos.y, \
square_size*2, square_size*2));
//pmath->get_image()->setTrackingBoxSize(QSize(pmath->get_square_size(), \
pmath->get_square_size()));
+ pmath->performProcessing();
+
if (pmath->isStarLost())
- {
+ {
+ //ui.startCalibrationLED->setColor(alertColor);
+ //KMessageBox::error(NULL, i18n("Lost track of the guide star. Try \
increasing the square size or reducing pulse duration.")); + emit \
newLog(i18n("Lost track of the guide star. Try increasing the square size or reducing \
pulse duration.")); + reset();
+
calibrationStage = CAL_ERROR;
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- ui.startCalibrationLED->setColor(alertColor);
- KMessageBox::error(NULL, i18n("Lost track of the guide star. Try increasing \
the square size or reducing pulse duration."));
- reset();
return;
}
@@ -257,10 +254,6 @@ void InternalGuider::processCalibration()
case CAL_NONE:
break;
- case CAL_MANUAL:
- calibrateManualReticle();
- break;
-
case CAL_RA_AUTO:
calibrateRADECRecticle(true);
break;
@@ -269,8 +262,6 @@ void InternalGuider::processCalibration()
calibrateRADECRecticle(false);
break;
}
-
-#endif
}
/*bool InternalGuider::isCalibrating()
@@ -281,10 +272,24 @@ void InternalGuider::processCalibration()
return false;
}*/
+void InternalGuider::setGuideView(FITSView *guideView)
+{
+ guideFrame = guideView;
+
+ pmath->setGuideView(guideFrame);
+
+ //connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, \
SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection); +}
+
void InternalGuider::reset()
{
//FIXME
+ is_started = false;
+ state = GUIDE_IDLE;
+ //calibrationStage = CAL_IDLE;
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, \
SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection); +
#if 0
is_started = false;
ui.pushButton_StartCalibration->setText( i18n("Start") );
@@ -295,129 +300,15 @@ void InternalGuider::reset()
#endif
}
-void InternalGuider::calibrateManualReticle( void )
-{
- //----- manual mode ----
- // get start point
-
- calibrationType = CAL_MANUAL;
-
- // FIXME
-
-#if 0
-
- if( !is_started )
- {
- if( ui.twoAxisCheck->checkState() == Qt::Checked )
- {
- ui.pushButton_StartCalibration->setText( i18n("Stop GUIDE_RA") );
- }
- else
- {
- ui.pushButton_StartCalibration->setText( i18n("Stop") );
- }
- guideModule->appendLogText(i18n("Drift scope in RA. Press stop when \
done."));
-
- calibrationStage = CAL_START;
- pmath->getStarScreenPosition( &start_x1, &start_y1 );
-
- axis = GUIDE_RA;
- is_started = true;
- }
- else // get end point and calc orientation
- {
- if( ui.twoAxisCheck->checkState() == Qt::Checked )
- {
- if( axis == GUIDE_RA )
- {
- pmath->getStarScreenPosition( &end_x1, &end_y1 );
-
- start_x2 = end_x1;
- start_y2 = end_y1;
-
- axis = GUIDE_DEC;
-
- ui.pushButton_StartCalibration->setText( i18n("Stop GUIDE_DEC") );
- guideModule->appendLogText(i18n("Drift scope in DEC. Press Stop when \
done."));
- return;
- }
- else
- {
- pmath->getStarScreenPosition( &end_x2, &end_y2 );
- bool dec_swap=false;
- // calc orientation
- if( pmath->calculateAndSetReticle2D( start_x1, start_y1, end_x1, \
end_y1, start_x2, start_y2, end_x2, end_y2, &dec_swap ) )
- {
- fillInterface();
- if (dec_swap)
- guideModule->appendLogText(i18n("DEC swap enabled."));
- else
- guideModule->appendLogText(i18n("DEC swap disabled."));
-
- guideModule->appendLogText(i18n("Calibration completed."));
-
- KNotification::event( QLatin1String( "CalibrationSuccessful" ) , \
i18n("Guiding calibration completed successfully"));
- calibrationStage = CAL_FINISH;
-
- emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
-
- guideModule->setDECSwap(dec_swap);
- }
- else
- {
- QMessageBox::warning( this, i18n("Error"), i18n("Calibration \
rejected. Start drift is too short."), QMessageBox::Ok );
- is_started = false;
- calibrationStage = CAL_ERROR;
- emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- }
- }
- }
- else
- {
- pmath->getStarScreenPosition( &end_x1, &end_y1 );
-
- if( pmath->calculateAndSetReticle1D( start_x1, start_y1, end_x1, end_y1 \
) )
- {
- calibrationStage = CAL_FINISH;
- fillInterface();
- guideModule->appendLogText(i18n("Calibration completed."));
-
- emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
-
- KNotification::event( QLatin1String( "CalibrationSuccessful" ) , \
i18n("Guiding calibration completed successfully"));
- }
- else
- {
- calibrationStage = CAL_ERROR;
-
- emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
-
- QMessageBox::warning( this, i18n("Error"), i18n("Calibration \
rejected. Start drift is too short."), QMessageBox::Ok );
- is_started = false;
- KNotification::event( QLatin1String( "CalibrationFailed" ) , \
i18n("Guiding calibration failed with errors"));
- }
- }
-
- reset();
-
- }
-
-#endif
-}
-
void InternalGuider::calibrateRADECRecticle( bool ra_only )
{
- // FIXME
-#if 0
bool auto_term_ok = false;
+ Q_ASSERT(pmath);
- if( !pmath )
- return;
-
- int pulseDuration = ui.spinBox_Pulse->value();
- int totalPulse = pulseDuration * auto_drift_time;
+ int pulseDuration = Options::calibrationPulseDuration();
+ int totalPulse = pulseDuration * Options::autoModeIterations();
if (ra_only)
calibrationType = CAL_RA_AUTO;
@@ -429,7 +320,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
case CAL_START:
//----- automatic mode -----
- auto_drift_time = ui.spinBox_DriftTime->value();
+ auto_drift_time = Options::autoModeIterations();
if (ra_only)
turn_back_time = auto_drift_time*2 + auto_drift_time/2;
@@ -437,39 +328,26 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
turn_back_time = auto_drift_time*6;
iterations = 0;
- ui.progressBar->setMaximum( turn_back_time );
-
- ui.progressBar->setValue( 0 );
+ emit newLog(i18n("GUIDE_RA drifting forward..."));
- ui.pushButton_StartCalibration->setText(i18n("Abort"));
-
- guideModule->appendLogText(i18n("GUIDE_RA drifting forward..."));
-
- // get start point
- //pmath->get_star_screen_pos( &start_x1, &start_y1 );
-
- start_x1 = ui.spinBox_ReticleX->value();
- start_y1 = ui.spinBox_ReticleY->value();
+ pmath->getReticleParameters(&start_x1, &start_y1, NULL);
if (Options::guideLogging())
qDebug() << "Guide: Start X1 " << start_x1 << " Start Y1 " << start_y1;
- guideModule->sendPulse( RA_INC_DIR, pulseDuration );
+ emit newPulse( RA_INC_DIR, pulseDuration );
+
if (Options::guideLogging())
qDebug() << "Guide: Iteration " << iterations << " Direction: " << \
RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
iterations++;
- ui.progressBar->setValue( iterations );
-
calibrationStage = CAL_RA_INC;
- ui.startCalibrationLED->setColor(busyColor);
-
break;
case CAL_RA_INC:
- guideModule->sendPulse( RA_INC_DIR, pulseDuration );
+ emit newPulse( RA_INC_DIR, pulseDuration );
if (Options::guideLogging())
{
@@ -477,12 +355,10 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
double cur_x, cur_y;
pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x \
<< "," << cur_y;
-
qDebug() << "Guide: Iteration " << iterations << " Direction: " << \
RA_INC_DIR << " Duration: " << pulseDuration << " ms."; }
iterations++;
- ui.progressBar->setValue( iterations );
if (iterations == auto_drift_time)
calibrationStage = CAL_RA_DEC;
@@ -500,7 +376,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
phi = pmath->calculatePhi( start_x1, start_y1, end_x1, end_y1 );
ROT_Z = RotateZ( -M_PI*phi/180.0 ); // derotates...
- guideModule->appendLogText(i18n("GUIDE_RA drifting reverse..."));
+ emit newLog(i18n("GUIDE_RA drifting reverse..."));
}
@@ -528,7 +404,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
{
if (iterations < turn_back_time)
{
- guideModule->sendPulse( RA_DEC_DIR, pulseDuration );
+ emit newPulse( RA_DEC_DIR, pulseDuration );
if (Options::guideLogging())
{
@@ -536,13 +412,10 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
double cur_x, cur_y;
pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << \
cur_x << "," << cur_y;
-
qDebug() << "Guide: Iteration " << iterations << " Direction: " \
<< RA_INC_DIR << " Duration: " << pulseDuration << " ms."; }
iterations++;
-
- ui.progressBar->setValue( iterations );
break;
}
@@ -550,10 +423,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- if (ui.autoStarCheck->isChecked())
- guideModule->appendLogText(i18np("GUIDE_RA: Scope cannot reach the \
start point after %1 iteration. Possible mount or drive problems...", "GUIDE_RA: \
Scope cannot reach the start point after %1 iterations. Possible mount or drive \
problems...", turn_back_time));
- else
- QMessageBox::warning( this, i18n("Warning"), i18np("GUIDE_RA: Scope \
cannot reach the start point after %1 iteration. Possible mount or drive \
problems...", "GUIDE_RA: Scope cannot reach the start point after %1 iterations. \
Possible mount or drive problems...", turn_back_time), QMessageBox::Ok ); + \
emit newLog(i18np("GUIDE_RA: Scope cannot reach the start point after %1 iteration. \
Possible mount or drive problems...", "GUIDE_RA: Scope cannot reach the start point \
after %1 iterations. Possible mount or drive problems...", turn_back_time));
KNotification::event( QLatin1String( "CalibrationFailed" ) , \
i18n("Guiding calibration failed with errors")); reset();
@@ -569,7 +439,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
if (Options::guideLogging())
qDebug() << "Guide: Start X2 " << start_x2 << " start Y2 " << \
start_y2;
- guideModule->sendPulse( DEC_INC_DIR, pulseDuration );
+ emit newPulse( DEC_INC_DIR, pulseDuration );
if (Options::guideLogging())
{
@@ -577,37 +447,34 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
double cur_x, cur_y;
pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << \
cur_x << "," << cur_y;
-
qDebug() << "Guide: Iteration " << iterations << " Direction: " << \
RA_INC_DIR << " Duration: " << pulseDuration << " ms."; }
iterations++;
- dec_iterations = 1;
- ui.progressBar->setValue( iterations );
- guideModule->appendLogText(i18n("GUIDE_DEC drifting forward..."));
+ dec_iterations = 1;
+ emit newLog(i18n("GUIDE_DEC drifting forward..."));
break;
}
// calc orientation
if( pmath->calculateAndSetReticle1D( start_x1, start_y1, end_x1, end_y1, \
totalPulse) ) {
- calibrationStage = CAL_FINISH;
- fillInterface();
- guideModule->appendLogText(i18n("Calibration completed."));
+ calibrationStage = CAL_IDLE;
+
+ // FIXME what is this for?
+ //fillInterface();
+
+ emit newLog(i18n("Calibration completed."));
emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
- ui.startCalibrationLED->setColor(okColor);
KNotification::event( QLatin1String( "CalibrationSuccessful" ) , \
i18n("Guiding calibration completed successfully")); //if \
(ui.autoStarCheck->isChecked()) //guideModule->selectAutoStar();
}
else
{
- if (ui.autoStarCheck->isChecked())
- guideModule->appendLogText(i18n("Calibration rejected. Star drift is \
too short."));
- else
- QMessageBox::warning( this, i18n("Error"), i18n("Calibration \
rejected. Star drift is too short."), QMessageBox::Ok );
- ui.startCalibrationLED->setColor(alertColor);
+ emit newLog(i18n("Calibration rejected. Star drift is too short."));
+
calibrationStage = CAL_ERROR;
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
@@ -620,7 +487,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
}
case CAL_DEC_INC:
- guideModule->sendPulse( DEC_INC_DIR, pulseDuration );
+ emit newPulse( DEC_INC_DIR, pulseDuration );
if (Options::guideLogging())
{
@@ -628,13 +495,11 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
double cur_x, cur_y;
pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x \
<< "," << cur_y;
-
qDebug() << "Guide: Iteration " << iterations << " Direction: " << \
RA_INC_DIR << " Duration: " << pulseDuration << " ms."; }
iterations++;
dec_iterations++;
- ui.progressBar->setValue( iterations );
if (dec_iterations == auto_drift_time)
calibrationStage = CAL_DEC_DEC;
@@ -652,7 +517,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
phi = pmath->calculatePhi( start_x2, start_y2, end_x2, end_y2 );
ROT_Z = RotateZ( -M_PI*phi/180.0 ); // derotates...
- guideModule->appendLogText(i18n("GUIDE_DEC drifting reverse..."));
+ emit newLog(i18n("GUIDE_DEC drifting reverse..."));
}
//----- Z-check (new!) -----
@@ -684,7 +549,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
{
if (iterations < turn_back_time)
{
- guideModule->sendPulse( DEC_DEC_DIR, pulseDuration );
+ emit newPulse(DEC_DEC_DIR, pulseDuration );
if (Options::guideLogging())
{
@@ -692,14 +557,11 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
double cur_x, cur_y;
pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << \
cur_x << "," << cur_y;
-
qDebug() << "Guide: Iteration " << iterations << " Direction: " \
<< RA_INC_DIR << " Duration: " << pulseDuration << " ms."; }
iterations++;
dec_iterations++;
-
- ui.progressBar->setValue( iterations );
break;
}
@@ -707,10 +569,7 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- if (ui.autoStarCheck->isChecked())
- guideModule->appendLogText(i18np("GUIDE_DEC: Scope cannot reach the \
start point after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: \
Scope cannot reach the start point after %1 iterations.\nPossible mount or drive \
problems...", turn_back_time));
- else
- QMessageBox::warning( this, i18n("Warning"), i18np("GUIDE_DEC: Scope \
cannot reach the start point after %1 iteration.\nPossible mount or drive \
problems...", "GUIDE_DEC: Scope cannot reach the start point after %1 \
iterations.\nPossible mount or drive problems...", turn_back_time), QMessageBox::Ok \
); + emit newLog(i18np("GUIDE_DEC: Scope cannot reach the start point \
after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: Scope cannot \
reach the start point after %1 iterations.\nPossible mount or drive problems...", \
turn_back_time));
KNotification::event( QLatin1String( "CalibrationFailed" ) , \
i18n("Guiding calibration failed with errors")); reset();
@@ -721,18 +580,18 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
// calc orientation
if( pmath->calculateAndSetReticle2D( start_x1, start_y1, end_x1, end_y1, \
start_x2, start_y2, end_x2, end_y2, &swap_dec, totalPulse ) ) {
- calibrationStage = CAL_FINISH;
- fillInterface();
+ calibrationStage = CAL_IDLE;
+ //fillInterface();
if (swap_dec)
- guideModule->appendLogText(i18n("DEC swap enabled."));
+ emit newLog(i18n("DEC swap enabled."));
else
- guideModule->appendLogText(i18n("DEC swap disabled."));
- guideModule->appendLogText(i18n("Calibration completed."));
+ emit newLog(i18n("DEC swap disabled."));
+
+ emit newLog(i18n("Calibration completed."));
emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
- ui.startCalibrationLED->setColor(okColor);
- guideModule->setDECSwap(swap_dec);
+ emit DESwapChanged(swap_dec);
KNotification::event( QLatin1String( "CalibrationSuccessful" ) , \
i18n("Guiding calibration completed successfully"));
@@ -742,14 +601,11 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
}
else
{
- if (ui.autoStarCheck->isChecked())
- guideModule->appendLogText(i18n("Calibration rejected. Star drift is \
too short."));
- else
- QMessageBox::warning( this, i18n("Error"), i18n("Calibration \
rejected. Star drift is too short."), QMessageBox::Ok ); + emit \
newLog(i18n("Calibration rejected. Star drift is too short."));
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- ui.startCalibrationLED->setColor(alertColor);
+ //ui.startCalibrationLED->setColor(alertColor);
calibrationStage = CAL_ERROR;
KNotification::event( QLatin1String( "CalibrationFailed" ) , \
i18n("Guiding calibration failed with errors")); }
@@ -764,41 +620,41 @@ void InternalGuider::calibrateRADECRecticle( bool ra_only )
break;
}
+}
-#endif
+void InternalGuider::setStarPosition(QVector3D starCenter)
+{
+ pmath->setReticleParameters(starCenter.x(), starCenter.y(), -1);
}
void InternalGuider::trackingStarSelected(int x, int y)
{
+ if (calibrationStage == CAL_IDLE)
+ return;
- // FIXME
-
-#if 0
//int square_size = guide_squares[pmath->getSquareIndex()].size;
- pmath->setReticleParameters(x, y, ui.spinBox_ReticleAngle->value());
+ pmath->setReticleParameters(x, y, -1);
//pmath->moveSquare(x-square_size/(2*pmath->getBinX()), \
y-square_size/(2*pmath->getBinY()));
- update_reticle_pos(x, y);
+ //update_reticle_pos(x, y);
+
- if (calibrationStage == CAL_FINISH)
- return;
- ui.selectStarLED->setColor(okColor);
+ //ui.selectStarLED->setColor(okColor);
calibrationStage = CAL_START;
- ui.pushButton_StartCalibration->setEnabled(true);
+ //ui.pushButton_StartCalibration->setEnabled(true);
- QVector3D starCenter = guideModule->getStarPosition();
+ QVector3D starCenter; // = guideModule->getStarPosition();
starCenter.setX(x);
- starCenter.setY(y);
- guideModule->setStarPosition(starCenter, true);
+ starCenter.setY(y);
+ emit newStarPosition(starCenter, true);
- if (ui.autoStarCheck->isChecked())
- startCalibration();
-
-#endif
+ //if (ui.autoStarCheck->isChecked())
+ if (Options::autoStarEnabled())
+ calibrate();
}
#if 0
@@ -905,5 +761,8 @@ void InternalGuider::toggleAutoSquareSize(bool enable)
#endif
-
+void InternalGuider::setDECSwap(bool enable)
+{
+ pmath->setDeclinationSwapEnabled(enable);
+}
}
diff --git a/kstars/ekos/guide/internalguide/internalguider.h \
b/kstars/ekos/guide/internalguide/internalguider.h index 0f825df..b3b1c8f 100644
--- a/kstars/ekos/guide/internalguide/internalguider.h
+++ b/kstars/ekos/guide/internalguide/internalguider.h
@@ -15,6 +15,7 @@
#include <QFile>
#include <QPixmap>
+#include "indi/indicommon.h"
#include "fitsviewer/fitsview.h"
#include "matr.h"
@@ -27,11 +28,12 @@ namespace Ekos
class InternalGuider : public GuideInterface
{
+ Q_OBJECT
public:
- enum CalibrationStage { CAL_CAPTURE_IMAGE, CAL_SELECT_STAR, CAL_FINISH, \
CAL_ERROR, CAL_START, CAL_RA_INC, CAL_RA_DEC, CAL_DEC_INC, \
CAL_DEC_DEC };
- enum CalibrationType { CAL_NONE, CAL_MANUAL, CAL_RA_AUTO, CAL_RA_DEC_AUTO };
+ enum CalibrationStage { CAL_IDLE, CAL_ERROR, CAL_CAPTURE_IMAGE, CAL_SELECT_STAR, \
CAL_START, CAL_RA_INC, CAL_RA_DEC, CAL_DEC_INC, CAL_DEC_DEC }; + enum \
CalibrationType { CAL_NONE, CAL_RA_AUTO, CAL_RA_DEC_AUTO };
InternalGuider();
~InternalGuider();
@@ -41,19 +43,27 @@ public:
bool calibrate() override;
bool guide() override;
- bool stop() override;
+ bool abort() override;
bool suspend() override;
bool resume() override;
bool dither(double pixels) override;
+ bool setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t \
binX, uint16_t binY) override;
bool setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double \
mountAperture, double mountFocalLength) override;
+ // Set Star Position
+ void setStarPosition(QVector3D starCenter) override;
+
+ // Select algorithm
void setSquareAlgorithm( int index );
// Reticle Parameters
void setReticleParameters(double x, double y, double angle);
bool getReticleParameters(double *x, double *y, double *angle);
+ // Guide View
+ void setGuideView(FITSView *guideView);
+
/// IMPORTED CHECK THEM ALL
@@ -79,22 +89,25 @@ public slots:
void setDECSwap(bool enable);
// OBSELETE
- void connectPHD2();
- void setPHD2Connected();
- void setPHD2Disconnected();
+ //void connectPHD2();
+ //void setPHD2Connected();
+ //void setPHD2Disconnected();
// Only called by PHD2
- void toggleExternalGuideStateGUI(Ekos::GuideState state);
+ //void toggleExternalGuideStateGUI(Ekos::GuideState state);
protected slots:
- void openCalibrationOptions();
- void openGuideOptions();
+ //void openCalibrationOptions();
+ //void openGuideOptions();
- void capture();
+ //void capture();
void trackingStarSelected(int x, int y);
signals:
void newProfilePixmap(QPixmap &);
+ void newPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int \
dec_msecs ); + void newPulse( GuideDirection dir, int msecs );
+ void DESwapChanged(bool enable);
private:
cgmath *pmath;
@@ -115,7 +128,7 @@ private:
// IMPORTED FROM R_CALIBRATION - CLEAN UP
- void fillInterface( void );
+ //void fillInterface( void );
void calibrateManualReticle( void );
void calibrateRADECRecticle( bool ra_only ); // 1 or 2-axis calibration
diff --git a/kstars/ekos/guide/opscalibration.cpp \
b/kstars/ekos/guide/opscalibration.cpp index f45bc76..f4ddcc8 100644
--- a/kstars/ekos/guide/opscalibration.cpp
+++ b/kstars/ekos/guide/opscalibration.cpp
@@ -36,8 +36,7 @@ OpsCalibration::OpsCalibration(InternalGuider *guiderObject) : \
QFrame( KStars:: 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() ) ); + connect( m_ConfigDialog->button(QDialogButtonBox::Ok), \
SIGNAL( clicked() ), SLOT( slotApply() ) ); }
@@ -64,8 +63,4 @@ 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
index 0146122..9123411 100644
--- a/kstars/ekos/guide/opscalibration.h
+++ b/kstars/ekos/guide/opscalibration.h
@@ -40,7 +40,6 @@ protected:
private slots:
void slotApply();
- void slotCancel();
private:
KConfigDialog *m_ConfigDialog;
diff --git a/kstars/ekos/guide/opscalibration.ui \
b/kstars/ekos/guide/opscalibration.ui index d29d886..ba6a570 100644
--- a/kstars/ekos/guide/opscalibration.ui
+++ b/kstars/ekos/guide/opscalibration.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>298</width>
+ <width>273</width>
<height>168</height>
</rect>
</property>
@@ -22,14 +22,27 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
+ <item row="0" column="1">
<widget class="QLabel" name="l_29">
<property name="text">
<string>Pulse:</string>
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="kcfg_AutoModeIterations">
+ <property name="minimum">
+ <number>3</number>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
<widget class="QSpinBox" name="kcfg_CalibrationPulseDuration">
<property name="minimum">
<number>100</number>
@@ -45,26 +58,10 @@
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="kcfg_AutoModeEnabled">
- <property name="text">
- <string>Auto mode</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item row="1" column="1">
- <widget class="QSpinBox" name="kcfg_AutoModeIterations">
- <property name="minimum">
- <number>3</number>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- <property name="value">
- <number>5</number>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Iterations:</string>
</property>
</widget>
</item>
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index d33e42e..55dfd73 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -1608,11 +1608,7 @@ sky map.</whatsthis>
<entry name="GuideSquareSizeIndex" type="UInt">
<label>Guide square size index (0 to 4) corresponding to pixel sizes (8 to \
128).</label> <default>1</default>
- </entry>
- <entry name="AutoModeEnabled" type="Bool">
- <label>Automatically calibrate selected axes.</label>
- <default>true</default>
- </entry>
+ </entry>
<entry name="AutoStarEnabled" type="Bool">
<label>Automatically select calibration star and perform \
calibration.</label> <default>false</default>
diff --git a/kstars/org.kde.kstars.Ekos.Guide.xml \
b/kstars/org.kde.kstars.Ekos.Guide.xml index 51cb54c..db4a65a 100644
--- a/kstars/org.kde.kstars.Ekos.Guide.xml
+++ b/kstars/org.kde.kstars.Ekos.Guide.xml
@@ -4,13 +4,10 @@
<method name="startGuiding">
<arg type="b" direction="out"/>
</method>
- <method name="stopGuiding">
+ <method name="abort">
<arg type="b" direction="out"/>
</method>
- <method name="startCalibration">
- <arg type="b" direction="out"/>
- </method>
- <method name="stopCalibration">
+ <method name="calibrate">
<arg type="b" direction="out"/>
</method>
<method name="capture">
@@ -77,7 +74,7 @@
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
- <method name="setGuideRapid">
+ <method name="setGuideRapidEnabled">
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic