diff --git a/kstars/ekos/scheduler/scheduler.cpp b/kstars/ekos/scheduler/scheduler.cpp --- a/kstars/ekos/scheduler/scheduler.cpp +++ b/kstars/ekos/scheduler/scheduler.cpp @@ -4673,15 +4673,18 @@ evaluateJobs(); /* If current job is actually complete because of previous duplicates, prepare for next job */ - if (currentJob->getRepeatsRemaining() == 0) + if (currentJob == nullptr || currentJob->getRepeatsRemaining() == 0) { stopCurrentJobAction(); stopGuiding(); - appendLogText(i18np("Job '%1' is complete after #%2 batch.", - "Job '%1' is complete after #%2 batches.", - currentJob->getName(), currentJob->getRepeatsRequired())); - setCurrentJob(nullptr); + if (currentJob != nullptr) + { + appendLogText(i18np("Job '%1' is complete after #%2 batch.", + "Job '%1' is complete after #%2 batches.", + currentJob->getName(), currentJob->getRepeatsRequired())); + setCurrentJob(nullptr); + } schedulerTimer.start(); } /* If job requires more work, continue current observation */ @@ -5059,7 +5062,7 @@ QString const signature = oneSeqJob->getSignature(); /* If frame is LIGHT, how hany do we have left? */ if (oneSeqJob->getFrameType() == FRAME_LIGHT) - lightFramesRequired += oneSeqJob->getCount() - newFramesCount[signature]; + lightFramesRequired += oneSeqJob->getCount()*oneJob->getRepeatsRequired() - newFramesCount[signature]; } oneJob->setLightFramesRequired(lightFramesRequired > 0); } @@ -5104,6 +5107,11 @@ int totalSequenceCount = 0, totalCompletedCount = 0; double totalImagingTime = 0; + // Determine number of captures in the scheduler job + int capturesPerRepeat = 0; + foreach (SequenceJob *seqJob, seqJobs) + capturesPerRepeat += seqJob->getCount(); + // Loop through sequence jobs to calculate the number of required frames and estimate duration. foreach (SequenceJob *seqJob, seqJobs) { @@ -5211,8 +5219,8 @@ // From now on, 'captures_completed' is the number of frames completed for the *current* sequence job } // Else rely on the captures done during this session - else captures_completed = schedJob->getCompletedCount(); - + else + captures_completed = schedJob->getCompletedCount() / capturesPerRepeat * seqJob->getCount(); // Check if we still need any light frames. Because light frames changes the flow of the observatory startup // Without light frames, there is no need to do focusing, alignment, guiding...etc @@ -5266,7 +5274,10 @@ schedJob->setCapturedFramesMap(capture_map); schedJob->setSequenceCount(totalSequenceCount); - schedJob->setCompletedCount(totalCompletedCount); + + // only in case we remember the job progress, we change the completion count + if (rememberJobProgress) + schedJob->setCompletedCount(totalCompletedCount); qDeleteAll(seqJobs);