Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/capture/capture.cpp
Show First 20 Lines • Show All 433 Lines • ▼ Show 20 Line(s) | 334 | { | |||
---|---|---|---|---|---|
434 | prepareJob(first_job); | 434 | prepareJob(first_job); | ||
435 | } | 435 | } | ||
436 | 436 | | |||
437 | void Capture::stop(bool abort) | 437 | void Capture::stop(bool abort) | ||
438 | { | 438 | { | ||
439 | retries = 0; | 439 | retries = 0; | ||
440 | seqTotalCount = 0; | 440 | seqTotalCount = 0; | ||
441 | seqCurrentCount = 0; | 441 | seqCurrentCount = 0; | ||
442 | | ||||
442 | ADURaw.clear(); | 443 | ADURaw.clear(); | ||
443 | ExpRaw.clear(); | 444 | ExpRaw.clear(); | ||
444 | 445 | | |||
445 | if (activeJob) | 446 | if (activeJob) | ||
446 | { | 447 | { | ||
447 | if (activeJob->getStatus() == SequenceJob::JOB_BUSY) | 448 | if (activeJob->getStatus() == SequenceJob::JOB_BUSY) | ||
448 | { | 449 | { | ||
449 | KSNotification::event(QLatin1String("CaptureFailed"), i18n("CCD capture aborted")); | 450 | KSNotification::event(QLatin1String("CaptureFailed"), i18n("CCD capture aborted")); | ||
▲ Show 20 Lines • Show All 651 Lines • ▼ Show 20 Line(s) | 1099 | { | |||
1101 | // If there is no active job, ignore | 1102 | // If there is no active job, ignore | ||
1102 | if (activeJob == nullptr || meridianFlipStage >= MF_ALIGNING) | 1103 | if (activeJob == nullptr || meridianFlipStage >= MF_ALIGNING) | ||
1103 | return; | 1104 | return; | ||
1104 | 1105 | | |||
1105 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | 1106 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | ||
1106 | { | 1107 | { | ||
1107 | if (bp == nullptr) | 1108 | if (bp == nullptr) | ||
1108 | { | 1109 | { | ||
1109 | appendLogText(i18n("Failed to save file to %1", activeJob->getLocalDir() + activeJob->getDirectoryPostfix())); | 1110 | appendLogText(i18n("Failed to save file to %1", activeJob->getSignature())); | ||
1110 | abort(); | 1111 | abort(); | ||
1111 | return; | 1112 | return; | ||
1112 | } | 1113 | } | ||
1113 | 1114 | | |||
1114 | if (!strcmp(bp->name, "CCD2")) | 1115 | if (!strcmp(bp->name, "CCD2")) | ||
1115 | tChip = currentCCD->getChip(ISD::CCDChip::GUIDE_CCD); | 1116 | tChip = currentCCD->getChip(ISD::CCDChip::GUIDE_CCD); | ||
1116 | else | 1117 | else | ||
1117 | tChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD); | 1118 | tChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD); | ||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 1211 | { | |||
1214 | if (calibrationStage == CAL_CALIBRATION_COMPLETE) | 1215 | if (calibrationStage == CAL_CALIBRATION_COMPLETE) | ||
1215 | calibrationStage = CAL_CAPTURING; | 1216 | calibrationStage = CAL_CAPTURING; | ||
1216 | } | 1217 | } | ||
1217 | 1218 | | |||
1218 | seqCurrentCount++; | 1219 | seqCurrentCount++; | ||
1219 | activeJob->setCompleted(seqCurrentCount); | 1220 | activeJob->setCompleted(seqCurrentCount); | ||
1220 | imgProgress->setValue(seqCurrentCount); | 1221 | imgProgress->setValue(seqCurrentCount); | ||
1221 | 1222 | | |||
1222 | appendLogText(i18n("Received image %1 out of %2.", seqCurrentCount, seqTotalCount)); | 1223 | appendLogText(i18n("Received image %1 out of %2.", seqCurrentCount, getTotalFramesCount(activeJob->getSignature()))); | ||
1223 | 1224 | | |||
1224 | state = CAPTURE_IMAGE_RECEIVED; | 1225 | state = CAPTURE_IMAGE_RECEIVED; | ||
1225 | emit newStatus(Ekos::CAPTURE_IMAGE_RECEIVED); | 1226 | emit newStatus(Ekos::CAPTURE_IMAGE_RECEIVED); | ||
1226 | 1227 | | |||
1227 | currentImgCountOUT->setText(QString::number(seqCurrentCount)); | 1228 | currentImgCountOUT->setText(QString::number(seqCurrentCount)); | ||
1228 | 1229 | | |||
1229 | // Check if we need to execute post capture script first | 1230 | // Check if we need to execute post capture script first | ||
1230 | if (activeJob->getPostCaptureScript().isEmpty() == false) | 1231 | if (activeJob->getPostCaptureScript().isEmpty() == false) | ||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Line(s) | 1339 | { | |||
1435 | } | 1436 | } | ||
1436 | else | 1437 | else | ||
1437 | { | 1438 | { | ||
1438 | // If looping, we just increment the file system image count | 1439 | // If looping, we just increment the file system image count | ||
1439 | if (currentCCD->isLooping()) | 1440 | if (currentCCD->isLooping()) | ||
1440 | { | 1441 | { | ||
1441 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | 1442 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | ||
1442 | { | 1443 | { | ||
1443 | checkSeqBoundary(activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); | 1444 | checkSeqBoundary(activeJob->getSignature()); | ||
1444 | currentCCD->setNextSequenceID(nextSequenceID); | 1445 | currentCCD->setNextSequenceID(nextSequenceID); | ||
1445 | } | 1446 | } | ||
1446 | } | 1447 | } | ||
1447 | else | 1448 | else | ||
1448 | startNextExposure(); | 1449 | startNextExposure(); | ||
1449 | } | 1450 | } | ||
1450 | } | 1451 | } | ||
1451 | 1452 | | |||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 1478 | { | |||
1549 | if (activeJob->isPreview()) | 1550 | if (activeJob->isPreview()) | ||
1550 | { | 1551 | { | ||
1551 | rememberUploadMode = activeJob->getUploadMode(); | 1552 | rememberUploadMode = activeJob->getUploadMode(); | ||
1552 | currentCCD->setUploadMode(ISD::CCD::UPLOAD_CLIENT); | 1553 | currentCCD->setUploadMode(ISD::CCD::UPLOAD_CLIENT); | ||
1553 | } | 1554 | } | ||
1554 | 1555 | | |||
1555 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | 1556 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | ||
1556 | { | 1557 | { | ||
1557 | checkSeqBoundary(activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); | 1558 | checkSeqBoundary(activeJob->getSignature()); | ||
1558 | currentCCD->setNextSequenceID(nextSequenceID); | 1559 | currentCCD->setNextSequenceID(nextSequenceID); | ||
1559 | } | 1560 | } | ||
1560 | 1561 | | |||
1561 | state = CAPTURE_CAPTURING; | 1562 | state = CAPTURE_CAPTURING; | ||
1562 | 1563 | | |||
1563 | //if (activeJob->isPreview() == false) | 1564 | //if (activeJob->isPreview() == false) | ||
1564 | // NOTE: Why we didn't emit this before for preview? | 1565 | // NOTE: Why we didn't emit this before for preview? | ||
1565 | emit newStatus(Ekos::CAPTURE_CAPTURING); | 1566 | emit newStatus(Ekos::CAPTURE_CAPTURING); | ||
▲ Show 20 Lines • Show All 694 Lines • ▼ Show 20 Line(s) | 2259 | { | |||
2260 | currentImgCountOUT->setText(QString::number(seqCurrentCount)); | 2261 | currentImgCountOUT->setText(QString::number(seqCurrentCount)); | ||
2261 | 2262 | | |||
2262 | // set the progress info | 2263 | // set the progress info | ||
2263 | imgProgress->setEnabled(true); | 2264 | imgProgress->setEnabled(true); | ||
2264 | imgProgress->setMaximum(seqTotalCount); | 2265 | imgProgress->setMaximum(seqTotalCount); | ||
2265 | imgProgress->setValue(seqCurrentCount); | 2266 | imgProgress->setValue(seqCurrentCount); | ||
2266 | 2267 | | |||
2267 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | 2268 | if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL) | ||
2268 | updateSequencePrefix(activeJob->getFullPrefix(), activeJob->getLocalDir() + activeJob->getDirectoryPostfix()); | 2269 | updateSequencePrefix(activeJob->getFullPrefix(), activeJob->getSignature()); | ||
2269 | } | 2270 | } | ||
2270 | 2271 | | |||
2271 | // 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 | 2272 | // 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 | ||
2272 | if (ignoreJobProgress == false && activeJob->isPreview() == false) | 2273 | if (ignoreJobProgress == false && activeJob->isPreview() == false) | ||
2273 | { | 2274 | { | ||
2274 | QString signature = activeJob->getLocalDir() + activeJob->getDirectoryPostfix(); | 2275 | QString signature = activeJob->getSignature(); | ||
2275 | 2276 | | |||
2276 | checkSeqBoundary(signature); | 2277 | checkSeqBoundary(signature); | ||
2277 | 2278 | | |||
2278 | if (capturedFramesMap.contains(signature)) | 2279 | if (capturedFramesMap.contains(signature)) | ||
2279 | seqFileCount = capturedFramesMap[signature]; | 2280 | seqFileCount = capturedFramesMap[signature]; | ||
2280 | 2281 | | |||
2281 | if (seqFileCount > 0) | 2282 | if (seqFileCount > 0) | ||
2282 | { | 2283 | { | ||
2283 | // Fully complete | 2284 | // Fully complete | ||
2284 | if (seqFileCount >= seqTotalCount) | 2285 | if (seqFileCount >= getTotalFramesCount(signature)) | ||
2285 | { | 2286 | { | ||
2286 | seqCurrentCount = seqTotalCount; | 2287 | activeJob->setCompleted(seqFileCount); | ||
2287 | activeJob->setCompleted(seqCurrentCount); | 2288 | imgProgress->setValue(getTotalFramesCount(signature)); | ||
2288 | imgProgress->setValue(seqCurrentCount); | | |||
2289 | qCDebug(KSTARS_EKOS_CAPTURE) << "Job" << job->getFullPrefix() << "already complete."; | 2289 | qCDebug(KSTARS_EKOS_CAPTURE) << "Job" << job->getFullPrefix() << "already complete."; | ||
2290 | processJobCompletion(); | 2290 | processJobCompletion(); | ||
2291 | return; | 2291 | return; | ||
2292 | } | 2292 | } | ||
2293 | 2293 | | |||
2294 | // Partially complete | 2294 | // Partially complete | ||
2295 | seqCurrentCount = seqFileCount; | 2295 | seqCurrentCount = seqFileCount; | ||
2296 | activeJob->setCompleted(seqCurrentCount); | 2296 | activeJob->setCompleted(seqCurrentCount); | ||
▲ Show 20 Lines • Show All 433 Lines • ▼ Show 20 Line(s) | 2703 | { | |||
2730 | else if (count == 1) | 2730 | else if (count == 1) | ||
2731 | median = filterHFRList[0]; | 2731 | median = filterHFRList[0]; | ||
2732 | 2732 | | |||
2733 | // Add 2.5% (default) to the automatic initial HFR value to allow for minute changes in HFR without need to refocus | 2733 | // Add 2.5% (default) to the automatic initial HFR value to allow for minute changes in HFR without need to refocus | ||
2734 | // in case in-sequence-focusing is used. | 2734 | // in case in-sequence-focusing is used. | ||
2735 | HFRPixels->setValue(median + (median * (Options::hFRThresholdPercentage() / 100.0))); | 2735 | HFRPixels->setValue(median + (median * (Options::hFRThresholdPercentage() / 100.0))); | ||
2736 | } | 2736 | } | ||
2737 | 2737 | | |||
2738 | int Capture::getTotalFramesCount(QString signature) | ||||
2739 | { | ||||
2740 | | ||||
2741 | int result = 0; | ||||
2742 | bool found = false; | ||||
2743 | | ||||
2744 | foreach (SequenceJob *job, jobs) | ||||
2745 | { | ||||
2746 | // FIXME: this should be part of SequenceJob | ||||
2747 | QString sig = job->getSignature(); | ||||
2748 | if (sig == signature) | ||||
2749 | { | ||||
2750 | result += job->getCount(); | ||||
2751 | found = true; | ||||
2752 | } | ||||
2753 | } | ||||
2754 | | ||||
2755 | if (found) | ||||
2756 | return result; | ||||
2757 | else | ||||
2758 | return -1; | ||||
2759 | } | ||||
2760 | | ||||
2761 | | ||||
2738 | void Capture::setRotator(ISD::GDInterface *newRotator) | 2762 | void Capture::setRotator(ISD::GDInterface *newRotator) | ||
2739 | { | 2763 | { | ||
2740 | currentRotator = newRotator; | 2764 | currentRotator = newRotator; | ||
2741 | connect(currentRotator, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(updateRotatorNumber(INumberVectorProperty*)), Qt::UniqueConnection); | 2765 | connect(currentRotator, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(updateRotatorNumber(INumberVectorProperty*)), Qt::UniqueConnection); | ||
2742 | rotatorB->setEnabled(true); | 2766 | rotatorB->setEnabled(true); | ||
2743 | 2767 | | |||
2744 | rotatorSettings->setRotator(newRotator); | 2768 | rotatorSettings->setRotator(newRotator); | ||
2745 | 2769 | | |||
▲ Show 20 Lines • Show All 2059 Lines • ▼ Show 20 Line(s) | |||||
4805 | } | 4829 | } | ||
4806 | */ | 4830 | */ | ||
4807 | 4831 | | |||
4808 | void Capture::postScriptFinished(int exitCode) | 4832 | void Capture::postScriptFinished(int exitCode) | ||
4809 | { | 4833 | { | ||
4810 | appendLogText(i18n("Post capture script finished with code %1.", exitCode)); | 4834 | appendLogText(i18n("Post capture script finished with code %1.", exitCode)); | ||
4811 | 4835 | | |||
4812 | // if we're done | 4836 | // if we're done | ||
4813 | if (seqCurrentCount >= seqTotalCount) | 4837 | if (seqCurrentCount >= getTotalFramesCount(activeJob->getSignature())) | ||
4814 | { | 4838 | { | ||
4815 | processJobCompletion(); | 4839 | processJobCompletion(); | ||
4816 | return; | 4840 | return; | ||
4817 | } | 4841 | } | ||
4818 | 4842 | | |||
4819 | // Check if meridian condition is met | 4843 | // Check if meridian condition is met | ||
4820 | if (checkMeridianFlip()) | 4844 | if (checkMeridianFlip()) | ||
4821 | return; | 4845 | return; | ||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |