diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h --- a/kstars/ekos/capture/capture.h +++ b/kstars/ekos/capture/capture.h @@ -605,8 +605,18 @@ void startRefocusTimer(bool forced = false); /* Capture */ + + /** + * @brief Determine the overall number of target frames with the same signature. + * Assume capturing RGBLRGB, where in each sequence job there is only one frame. + * For "L" the result will be 1, for "R" it will be 2 etc. + * @param frame signature (typically the filter name) + * @return + */ + int getTotalFramesCount(QString signature); + double seqExpose { 0 }; - int seqTotalCount { 0 }; + int seqTotalCount; int seqCurrentCount { 0 }; int seqDelay { 0 }; int retries { 0 }; diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp --- a/kstars/ekos/capture/capture.cpp +++ b/kstars/ekos/capture/capture.cpp @@ -439,6 +439,7 @@ retries = 0; seqTotalCount = 0; seqCurrentCount = 0; + ADURaw.clear(); ExpRaw.clear(); @@ -1106,7 +1107,7 @@ { if (bp == nullptr) { - appendLogText(i18n("Failed to save file to %1", activeJob->getLocalDir() + activeJob->getDirectoryPostfix())); + appendLogText(i18n("Failed to save file to %1", activeJob->getSignature())); abort(); return; } @@ -1219,7 +1220,7 @@ activeJob->setCompleted(seqCurrentCount); imgProgress->setValue(seqCurrentCount); - appendLogText(i18n("Received image %1 out of %2.", seqCurrentCount, seqTotalCount)); + appendLogText(i18n("Received image %1 out of %2.", seqCurrentCount, getTotalFramesCount(activeJob->getSignature()))); state = CAPTURE_IMAGE_RECEIVED; emit newStatus(Ekos::CAPTURE_IMAGE_RECEIVED); @@ -1440,7 +1441,7 @@ { if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) { - checkSeqBoundary(activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); + checkSeqBoundary(activeJob->getSignature()); currentCCD->setNextSequenceID(nextSequenceID); } } @@ -1554,7 +1555,7 @@ if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) { - checkSeqBoundary(activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); + checkSeqBoundary(activeJob->getSignature()); currentCCD->setNextSequenceID(nextSequenceID); } @@ -2265,13 +2266,13 @@ imgProgress->setValue(seqCurrentCount); if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) - updateSequencePrefix(activeJob->getFullPrefix(), activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); + updateSequencePrefix(activeJob->getFullPrefix(), activeJob->getSignature()); } // We check if the job is already fully or partially complete by checking how many files of its type exist on the file system unless ignoreJobProgress is set to true if (ignoreJobProgress == false && activeJob->isPreview() == false) { - QString signature = activeJob->getLocalDir() + activeJob->getDirectoryPostfix(); + QString signature = activeJob->getSignature(); checkSeqBoundary(signature); @@ -2281,11 +2282,10 @@ if (seqFileCount > 0) { // Fully complete - if (seqFileCount >= seqTotalCount) + if (seqFileCount >= getTotalFramesCount(signature)) { - seqCurrentCount = seqTotalCount; - activeJob->setCompleted(seqCurrentCount); - imgProgress->setValue(seqCurrentCount); + activeJob->setCompleted(seqFileCount); + imgProgress->setValue(getTotalFramesCount(signature)); qCDebug(KSTARS_EKOS_CAPTURE) << "Job" << job->getFullPrefix() << "already complete."; processJobCompletion(); return; @@ -2735,6 +2735,30 @@ HFRPixels->setValue(median + (median * (Options::hFRThresholdPercentage() / 100.0))); } +int Capture::getTotalFramesCount(QString signature) +{ + + int result = 0; + bool found = false; + + foreach (SequenceJob *job, jobs) + { + // FIXME: this should be part of SequenceJob + QString sig = job->getSignature(); + if (sig == signature) + { + result += job->getCount(); + found = true; + } + } + + if (found) + return result; + else + return -1; +} + + void Capture::setRotator(ISD::GDInterface *newRotator) { currentRotator = newRotator; @@ -4810,7 +4834,7 @@ appendLogText(i18n("Post capture script finished with code %1.", exitCode)); // if we're done - if (seqCurrentCount >= seqTotalCount) + if (seqCurrentCount >= getTotalFramesCount(activeJob->getSignature())) { processJobCompletion(); return; diff --git a/kstars/ekos/capture/sequencejob.h b/kstars/ekos/capture/sequencejob.h --- a/kstars/ekos/capture/sequencejob.h +++ b/kstars/ekos/capture/sequencejob.h @@ -78,6 +78,7 @@ void setLocalDir(const QString &dir) { localDirectory = dir; } const QString &getLocalDir() { return localDirectory; } + QString getSignature() { return getLocalDir() + getDirectoryPostfix(); } void setTargetFilter(int pos, const QString &name); int getTargetFilter() { return targetFilter; }