summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2015-09-28 02:15:31 +0300
committerJasem Mutlaq <[email protected]>2015-09-28 02:15:31 +0300
commit85839eaf1cbf90cefa877dca5e448c2f5d8f773c (patch)
tree24205773cf87eca9929b0eca4d1bf847df824abd
parent198166c913115a62f80439e6ef02275c403a11b3 (diff)
Implement a better way to detector if focus module is busy
-rw-r--r--kstars/ekos/align.cpp8
-rw-r--r--kstars/ekos/align.h16
-rw-r--r--kstars/ekos/capture.cpp19
-rw-r--r--kstars/ekos/capture.h2
-rw-r--r--kstars/ekos/focus.cpp8
-rw-r--r--kstars/ekos/focus.h1
6 files changed, 45 insertions, 9 deletions
diff --git a/kstars/ekos/align.cpp b/kstars/ekos/align.cpp
index cee7c74..65044eb 100644
--- a/kstars/ekos/align.cpp
+++ b/kstars/ekos/align.cpp
@@ -61,6 +61,7 @@ Align::Align()
m_isSolverSuccessful = false;
m_slewToTargetSelected=false;
m_wcsSynced=false;
+ isFocusBusy=false;
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = sOrientation = sRA = sDEC = -1;
decDeviation = azDeviation = altDeviation = 0;
@@ -543,7 +544,7 @@ bool Align::captureAndSolve()
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
- if (targetChip->getCaptureMode() == FITS_FOCUS)
+ if (isFocusBusy)
{
appendLogText(i18n("Cannot capture while focus module is busy."));
return false;
@@ -1523,6 +1524,11 @@ void Align::checkCCDExposureProgress(ISD::CCDChip *targetChip, double remaining,
}
}
+void Align::updateFocusStatus(bool status)
+{
+ isFocusBusy = status;
+}
+
}
diff --git a/kstars/ekos/align.h b/kstars/ekos/align.h
index aee5345..d7585b4 100644
--- a/kstars/ekos/align.h
+++ b/kstars/ekos/align.h
@@ -179,6 +179,12 @@ public:
QString getLogText() { return logText.join("\n"); }
void clearLog();
+ /**
+ * @brief Return FOV object used to represent the solved image orientation on the sky map.
+ */
+ FOV *fov();
+
+
public slots:
/**
@@ -267,15 +273,12 @@ public slots:
*/
Q_SCRIPTABLE Q_NOREPLY void loadAndSlew(QUrl fileURL = QUrl());
- /**
- * @brief Return FOV object used to represent the solved image orientation on the sky map.
- */
- FOV *fov();
-
void setLockedFilter(ISD::GDInterface *filter, int lockedPosition);
void processFilterNumber(INumberVectorProperty *nvp);
+ void updateFocusStatus(bool status);
+
signals:
void newLog();
void solverComplete(bool);
@@ -343,6 +346,9 @@ private:
bool m_isSolverSuccessful;
bool m_slewToTargetSelected;
+ // Focus
+ bool isFocusBusy;
+
// FOV
double ccd_hor_pixel, ccd_ver_pixel, focal_length, aperture, fov_x, fov_y;
int ccd_width, ccd_height;
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index bd7ddf4..75ca6e3 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -150,8 +150,8 @@ void SequenceJob::prepareCapture()
SequenceJob::CAPTUREResult SequenceJob::capture(bool isDark)
{
// If focusing is busy, return error
- if (activeChip->getCaptureMode() == FITS_FOCUS)
- return CAPTURE_FOCUS_ERROR;
+ //if (activeChip->getCaptureMode() == FITS_FOCUS)
+ // return CAPTURE_FOCUS_ERROR;
if (targetFilter != -1 && activeFilter != NULL)
{
@@ -329,7 +329,7 @@ Capture::Capture()
setupUi(this);
new CaptureAdaptor(this);
- QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Capture", this);
+ QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Capture", this);
currentCCD = NULL;
currentTelescope = NULL;
@@ -422,6 +422,7 @@ Capture::Capture()
useGuideHead = false;
guideDither = false;
firstAutoFocus = true;
+ isFocusBusy = false;
foreach(QString filter, FITSViewer::filterTypes)
filterCombo->addItem(filter);
@@ -1211,6 +1212,13 @@ void Capture::captureImage()
bool isDark=false;
SequenceJob::CAPTUREResult rc=SequenceJob::CAPTURE_OK;
+ if (isFocusBusy)
+ {
+ appendLogText(i18n("Cannot capture while focus module is busy."));
+ abort();
+ return;
+ }
+
if (useGuideHead == false && darkSubCheck->isChecked() && calibrationState == CALIBRATE_NONE)
isDark = true;
@@ -1873,6 +1881,11 @@ void Capture::setAutoguiding(bool enable, bool isDithering)
guideDither = isDithering;
}
+void Capture::updateFocusStatus(bool status)
+{
+ isFocusBusy = status;
+}
+
void Capture::updateAutofocusStatus(bool status, double HFR)
{
autoFocusStatus = status;
diff --git a/kstars/ekos/capture.h b/kstars/ekos/capture.h
index 0b24ef5..4035c89 100644
--- a/kstars/ekos/capture.h
+++ b/kstars/ekos/capture.h
@@ -477,6 +477,7 @@ public slots:
void checkFrameType(int index);
void resetFrame();
+ void updateFocusStatus(bool status);
void updateAutofocusStatus(bool status, double HFR);
void updateCaptureProgress(ISD::CCDChip *tChip, double value, IPState state);
void checkSeqBoundary(const QString &path);
@@ -575,6 +576,7 @@ private:
bool isAutoFocus;
bool autoFocusStatus;
bool firstAutoFocus;
+ bool isFocusBusy;
//Meridan flip
double initialHA;
diff --git a/kstars/ekos/focus.cpp b/kstars/ekos/focus.cpp
index 82ce304..6412d0b 100644
--- a/kstars/ekos/focus.cpp
+++ b/kstars/ekos/focus.cpp
@@ -543,6 +543,8 @@ void Focus::start()
if (suspendGuideCheck->isChecked())
emit suspendGuiding(true);
+ emit statusUpdated(true);
+
capture();
}
@@ -560,6 +562,8 @@ void Focus::checkStopFocus()
stopFocusB->setEnabled(false);
appendLogText(i18n("Capture aborted."));
+
+ emit statusUpdated(false);
}
abort();
@@ -598,6 +602,8 @@ void Focus::abort()
HFRInc=0;
reverseDir = false;
+ emit statusUpdated(false);
+
}
void Focus::capture()
@@ -1565,6 +1571,8 @@ void Focus::startFraming()
{
inFocusLoop = true;
+ emit statusUpdated(true);
+
resetButtons();
appendLogText(i18n("Starting continuous exposure..."));
diff --git a/kstars/ekos/focus.h b/kstars/ekos/focus.h
index 33c631c..6060d5e 100644
--- a/kstars/ekos/focus.h
+++ b/kstars/ekos/focus.h
@@ -313,6 +313,7 @@ signals:
void autoFocusFinished(bool status, double finalHFR);
void suspendGuiding(bool suspend);
void filterLockUpdated(ISD::GDInterface *filter, int lockedIndex);
+ void statusUpdated(bool status);
private:
void drawHFRPlot();