summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-09 20:45:25 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-09 20:45:25 (GMT)
commit594cd91c274e52f623ef5e2689357c6f833eff6f (patch)
treeb6091bcf4b2dbc6131a70bc9d56f6274a952fe15
parenta3dcdb295e8c59bd0f814cc5c3a4b2306bf5bd28 (diff)
Retry failed tasks before giving up. Add new signal for image time progress
-rw-r--r--kstars/ekos/capture/capture.cpp47
-rw-r--r--kstars/ekos/capture/capture.h3
2 files changed, 40 insertions, 10 deletions
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index 28f36e0..4f9fb5b 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -440,7 +440,7 @@ void Capture::stop(bool abort)
secondsLabel->clear();
disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
disconnect(currentCCD, SIGNAL(newImage(QImage*,ISD::CCDChip*)), this, SLOT(sendNewImage(QImage*,ISD::CCDChip*)));
- disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double, IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)));
+ disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double, IPState)), this, SLOT(setExposureProgress(ISD::CCDChip*,double,IPState)));
currentCCD->setFITSDir("");
@@ -1024,7 +1024,7 @@ void Capture::newFITS(IBLOB *bp)
bool Capture::setCaptureComplete()
{
- disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)));
+ disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(setExposureProgress(ISD::CCDChip*,double,IPState)));
DarkLibrary::Instance()->disconnect(this);
secondsLabel->setText(i18n("Complete."));
@@ -1281,7 +1281,7 @@ void Capture::captureImage()
switch (rc)
{
case SequenceJob::CAPTURE_OK:
- connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)), Qt::UniqueConnection);
+ connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(setExposureProgress(ISD::CCDChip*,double,IPState)), Qt::UniqueConnection);
appendLogText(i18n("Capturing image..."));
break;
@@ -1423,17 +1423,20 @@ void Capture::clearLog()
emit newLog();
}
-void Capture::updateCaptureProgress(ISD::CCDChip * tChip, double value, IPState state)
+void Capture::setExposureProgress(ISD::CCDChip * tChip, double value, IPState state)
{
-
if (targetChip != tChip || targetChip->getCaptureMode() != FITS_NORMAL || meridianFlipStage >= MF_ALIGNING)
return;
exposeOUT->setText(QString::number(value, 'd', 2));
if (activeJob)
+ {
activeJob->setExposeLeft(value);
+ emit newExposureProgress(activeJob);
+ }
+
if (activeJob && state == IPS_ALERT)
{
int retries = activeJob->getCaptureRetires()+1;
@@ -1712,6 +1715,8 @@ void Capture::removeJob()
SequenceJob *job = jobs.at(currentRow);
jobs.removeOne(job);
+ if (job == activeJob)
+ activeJob = NULL;
delete (job);
if (queueTable->rowCount() == 0)
@@ -2980,6 +2985,7 @@ void Capture::processTelescopeNumber(INumberVectorProperty *nvp)
appendLogText(i18n("Performing post flip re-alignment..."));
secondsLabel->setText(i18n("Aligning..."));
+ retries = 0;
state = CAPTURE_ALIGNING;
emit newStatus(Ekos::CAPTURE_ALIGNING);
@@ -2989,6 +2995,7 @@ void Capture::processTelescopeNumber(INumberVectorProperty *nvp)
return;
}
+ retries = 0;
checkGuidingAfterFlip();
break;
@@ -3124,6 +3131,7 @@ void Capture::setAlignStatus(AlignState state)
if (meridianFlipStage == MF_ALIGNING)
{
appendLogText(i18n("Post flip re-alignment completed successfully."));
+ retries = 0;
checkGuidingAfterFlip();
}
break;
@@ -3132,8 +3140,21 @@ void Capture::setAlignStatus(AlignState state)
// TODO run it 3 times before giving up
if (meridianFlipStage == MF_ALIGNING)
{
- appendLogText(i18n("Post-flip alignment failed."));
- abort();
+ if (++retries == 3)
+ {
+ appendLogText(i18n("Post-flip alignment failed."));
+ abort();
+ }
+ else
+ {
+ appendLogText(i18n("Post-flip alignment failed. Retrying..."));
+ secondsLabel->setText(i18n("Aligning..."));
+
+ this->state = CAPTURE_ALIGNING;
+ emit newStatus(Ekos::CAPTURE_ALIGNING);
+
+ meridianFlipStage = MF_ALIGNING;
+ }
}
break;
@@ -3172,8 +3193,16 @@ void Capture::setGuideStatus(GuideState state)
// TODO try restarting calibration a couple of times before giving up
if (meridianFlipStage == MF_GUIDING)
{
- appendLogText(i18n("Post meridian flip calibration error. Aborting..."));
- abort();
+ if (++retries == 3)
+ {
+ appendLogText(i18n("Post meridian flip calibration error. Aborting..."));
+ abort();
+ }
+ else
+ {
+ appendLogText(i18n("Post meridian flip calibration error. Restarting..."));
+ checkGuidingAfterFlip();
+ }
}
break;
diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h
index 956e0a0..bbbad4e 100644
--- a/kstars/ekos/capture/capture.h
+++ b/kstars/ekos/capture/capture.h
@@ -396,7 +396,7 @@ private slots:
void checkFrameType(int index);
void resetFrame();
- void updateCaptureProgress(ISD::CCDChip *tChip, double value, IPState state);
+ void setExposureProgress(ISD::CCDChip *tChip, double value, IPState state);
void checkSeqBoundary(const QString &path);
void saveFITSDirectory();
void setDefaultCCD(QString ccd);
@@ -448,6 +448,7 @@ signals:
void meridianFlipCompleted();
void newStatus(Ekos::CaptureState status);
void newImage(QImage *image, Ekos::SequenceJob *job);
+ void newExposureProgress(Ekos::SequenceJob *job);
private: