summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2015-07-06 17:34:11 +0300
committerJasem Mutlaq <[email protected]>2015-07-06 17:34:11 +0300
commit3c49b2d78c52f962fac361dc8ba1a13f4582343b (patch)
tree094b66146a26508600aa2311c3acb7873ea6f7ed
parentc9e0e2720653b6ab3feaa1bc30ffec2256b5b57f (diff)
Adding a case to handle capture failure. Ekos will retry 3 times before giving
-rw-r--r--kstars/ekos/capture.cpp41
-rw-r--r--kstars/ekos/capture.h6
-rw-r--r--kstars/indi/indiccd.cpp19
-rw-r--r--kstars/indi/indiccd.h2
4 files changed, 49 insertions, 19 deletions
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index 0f4c298..7804b88 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -43,6 +43,7 @@
#define MF_TIMER_TIMEOUT 90000
#define MF_RA_DIFF_LIMIT 4
#define MAX_TEMP_DIFF 0.1
+#define MAX_CAPTURE_RETRIES 3
namespace Ekos
{
@@ -61,7 +62,8 @@ SequenceJob::SequenceJob()
activeCCD=NULL;
activeFilter= NULL;
statusCell = NULL;
- completed=0;
+ completed=0;
+ captureRetires=0;
}
void SequenceJob::reset()
@@ -76,6 +78,7 @@ void SequenceJob::resetStatus()
status = JOB_IDLE;
completed=0;
exposeLeft=0;
+ captureRetires=0;
if (preview == false && statusCell)
statusCell->setText(statusStrings[status]);
}
@@ -280,6 +283,16 @@ void SequenceJob::setTargetADU(double value)
{
targetADU = value;
}
+int SequenceJob::getCaptureRetires() const
+{
+ return captureRetires;
+}
+
+void SequenceJob::setCaptureRetires(int value)
+{
+ captureRetires = value;
+}
+
int SequenceJob::getISOIndex() const
{
@@ -573,7 +586,7 @@ void Capture::stopSequence()
secondsLabel->clear();
//currentCCD->disconnect(this);
disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
- disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double)));
+ disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double, IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)));
currentCCD->setFITSDir("");
@@ -1306,7 +1319,7 @@ void Capture::clearLog()
emit newLog();
}
-void Capture::updateCaptureProgress(ISD::CCDChip * tChip, double value)
+void Capture::updateCaptureProgress(ISD::CCDChip * tChip, double value, IPState state)
{
if (targetChip != tChip || targetChip->getCaptureMode() != FITS_NORMAL || meridianFlipStage >= MF_ALIGNING)
@@ -1317,8 +1330,28 @@ void Capture::updateCaptureProgress(ISD::CCDChip * tChip, double value)
if (activeJob)
activeJob->setExposeLeft(value);
+ if (activeJob && state == IPS_ALERT)
+ {
+ int retries = activeJob->getCaptureRetires()+1;
+
+ activeJob->setCaptureRetires(retries);
+
+ appendLogText(xi18n("Capture failed."));
+ if (retries == 3)
+ {
+ stopSequence();
+ return;
+ }
+
+ appendLogText(xi18n("Restarting capture attempt #%1", retries));
+ captureImage();
+ return;
+ }
+
if (value == 0)
{
+ activeJob->setCaptureRetires(0);
+
if (currentCCD && currentCCD->getUploadMode() == ISD::CCD::UPLOAD_LOCAL)
{
if (activeJob && activeJob->getStatus() == SequenceJob::JOB_BUSY && activeJob->getExposeLeft() == 0)
@@ -1712,7 +1745,7 @@ void Capture::executeJob()
useGuideHead = (activeJob->getActiveChip()->getType() == ISD::CCDChip::PRIMARY_CCD) ? false : true;
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
- connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double)));
+ connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)));
captureImage();
diff --git a/kstars/ekos/capture.h b/kstars/ekos/capture.h
index e66a8b4..df7b406 100644
--- a/kstars/ekos/capture.h
+++ b/kstars/ekos/capture.h
@@ -139,6 +139,9 @@ class SequenceJob : public QObject
double getTargetADU() const;
void setTargetADU(double value);
+ int getCaptureRetires() const;
+ void setCaptureRetires(int value);
+
signals:
void prepareComplete();
@@ -167,6 +170,7 @@ private:
bool showFITS;
bool filterReady, temperatureReady;
int isoIndex;
+ int captureRetires;
unsigned int completed;
double exposeLeft;
double currentTemperature, targetTemperature;
@@ -351,7 +355,7 @@ public slots:
void checkFrameType(int index);
void updateAutofocusStatus(bool status, double HFR);
- void updateCaptureProgress(ISD::CCDChip *tChip, double value);
+ void updateCaptureProgress(ISD::CCDChip *tChip, double value, IPState state);
void checkSeqBoundary(const QString &path);
void saveFITSDirectory();
diff --git a/kstars/indi/indiccd.cpp b/kstars/indi/indiccd.cpp
index 9933e93..a1ee62b 100644
--- a/kstars/indi/indiccd.cpp
+++ b/kstars/indi/indiccd.cpp
@@ -863,12 +863,9 @@ void CCD::processNumber(INumberVectorProperty *nvp)
{
if (!strcmp(nvp->name, "CCD_EXPOSURE"))
{
- if (nvp->s == IPS_BUSY)
- {
- INumber *np = IUFindNumber(nvp, "CCD_EXPOSURE_VALUE");
- if (np)
- emit newExposureValue(primaryChip, np->value);
- }
+ INumber *np = IUFindNumber(nvp, "CCD_EXPOSURE_VALUE");
+ if (np)
+ emit newExposureValue(primaryChip, np->value, nvp->s);
return;
}
@@ -885,13 +882,9 @@ void CCD::processNumber(INumberVectorProperty *nvp)
if (!strcmp(nvp->name, "GUIDER_EXPOSURE"))
{
- if (nvp->s == IPS_BUSY)
- {
- INumber *np = IUFindNumber(nvp, "GUIDER_EXPOSURE_VALUE");
- if (np)
- emit newExposureValue(guideChip, np->value);
- }
-
+ INumber *np = IUFindNumber(nvp, "GUIDER_EXPOSURE_VALUE");
+ if (np)
+ emit newExposureValue(guideChip, np->value, nvp->s);
return;
}
diff --git a/kstars/indi/indiccd.h b/kstars/indi/indiccd.h
index 65be4c6..a655367 100644
--- a/kstars/indi/indiccd.h
+++ b/kstars/indi/indiccd.h
@@ -163,7 +163,7 @@ public slots:
signals:
void FITSViewerClosed();
void newTemperatureValue(double value);
- void newExposureValue(ISD::CCDChip *chip, double value);
+ void newExposureValue(ISD::CCDChip *chip, double value, IPState state);
void newGuideStarData(ISD::CCDChip *chip, double dx, double dy, double fit);
private: