Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/scheduler/scheduler.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1282 Lines • ▼ Show 20 Line(s) | 1277 | { | |||
---|---|---|---|---|---|
1283 | // Stop running job and abort all others | 1283 | // Stop running job and abort all others | ||
1284 | // in case of soft shutdown we skip this | 1284 | // in case of soft shutdown we skip this | ||
1285 | if (preemptiveShutdown == false) | 1285 | if (preemptiveShutdown == false) | ||
1286 | { | 1286 | { | ||
1287 | bool wasAborted = false; | 1287 | bool wasAborted = false; | ||
1288 | foreach (SchedulerJob *job, jobs) | 1288 | foreach (SchedulerJob *job, jobs) | ||
1289 | { | 1289 | { | ||
1290 | if (job == currentJob) | 1290 | if (job == currentJob) | ||
1291 | { | | |||
1292 | stopCurrentJobAction(); | 1291 | stopCurrentJobAction(); | ||
1293 | stopGuiding(); | | |||
1294 | } | | |||
1295 | 1292 | | |||
1296 | if (job->getState() <= SchedulerJob::JOB_BUSY) | 1293 | if (job->getState() <= SchedulerJob::JOB_BUSY) | ||
1297 | { | 1294 | { | ||
1298 | appendLogText(i18n("Job '%1' has not been processed upon scheduler stop, marking aborted.", job->getName())); | 1295 | appendLogText(i18n("Job '%1' has not been processed upon scheduler stop, marking aborted.", job->getName())); | ||
1299 | job->setState(SchedulerJob::JOB_ABORTED); | 1296 | job->setState(SchedulerJob::JOB_ABORTED); | ||
1300 | wasAborted = true; | 1297 | wasAborted = true; | ||
1301 | } | 1298 | } | ||
1302 | } | 1299 | } | ||
▲ Show 20 Lines • Show All 1958 Lines • ▼ Show 20 Line(s) | 3238 | { | |||
3261 | { | 3258 | { | ||
3262 | // If the job reached it COMPLETION time, we stop it. | 3259 | // If the job reached it COMPLETION time, we stop it. | ||
3263 | if (now.secsTo(currentJob->getCompletionTime()) <= 0) | 3260 | if (now.secsTo(currentJob->getCompletionTime()) <= 0) | ||
3264 | { | 3261 | { | ||
3265 | appendLogText(i18n("Job '%1' reached completion time %2, stopping.", currentJob->getName(), | 3262 | appendLogText(i18n("Job '%1' reached completion time %2, stopping.", currentJob->getName(), | ||
3266 | currentJob->getCompletionTime().toString(currentJob->getDateTimeDisplayFormat()))); | 3263 | currentJob->getCompletionTime().toString(currentJob->getDateTimeDisplayFormat()))); | ||
3267 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | 3264 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | ||
3268 | stopCurrentJobAction(); | 3265 | stopCurrentJobAction(); | ||
3269 | stopGuiding(); | | |||
3270 | findNextJob(); | 3266 | findNextJob(); | ||
3271 | return; | 3267 | return; | ||
3272 | } | 3268 | } | ||
3273 | } | 3269 | } | ||
3274 | 3270 | | |||
3275 | // #2 Check if altitude restriction still holds true | 3271 | // #2 Check if altitude restriction still holds true | ||
3276 | if (-90 < currentJob->getMinAltitude()) | 3272 | if (-90 < currentJob->getMinAltitude()) | ||
3277 | { | 3273 | { | ||
Show All 9 Lines | 3280 | { | |||
3287 | { | 3283 | { | ||
3288 | appendLogText(i18n("Job '%1' current altitude (%2 degrees) crossed minimum constraint altitude (%3 degrees), " | 3284 | appendLogText(i18n("Job '%1' current altitude (%2 degrees) crossed minimum constraint altitude (%3 degrees), " | ||
3289 | "marking aborted.", currentJob->getName(), | 3285 | "marking aborted.", currentJob->getName(), | ||
3290 | QString("%L1").arg(p.alt().Degrees(), 0, 'f', minAltitude->decimals()), | 3286 | QString("%L1").arg(p.alt().Degrees(), 0, 'f', minAltitude->decimals()), | ||
3291 | QString("%L1").arg(currentJob->getMinAltitude(), 0, 'f', minAltitude->decimals()))); | 3287 | QString("%L1").arg(currentJob->getMinAltitude(), 0, 'f', minAltitude->decimals()))); | ||
3292 | 3288 | | |||
3293 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | 3289 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | ||
3294 | stopCurrentJobAction(); | 3290 | stopCurrentJobAction(); | ||
3295 | stopGuiding(); | | |||
3296 | findNextJob(); | 3291 | findNextJob(); | ||
3297 | return; | 3292 | return; | ||
3298 | } | 3293 | } | ||
3299 | } | 3294 | } | ||
3300 | } | 3295 | } | ||
3301 | 3296 | | |||
3302 | // #3 Check if moon separation is still valid | 3297 | // #3 Check if moon separation is still valid | ||
3303 | if (currentJob->getMinMoonSeparation() > 0) | 3298 | if (currentJob->getMinMoonSeparation() > 0) | ||
Show All 9 Lines | 3306 | { | |||
3313 | if (isMountParked() == false) | 3308 | if (isMountParked() == false) | ||
3314 | { | 3309 | { | ||
3315 | appendLogText(i18n("Job '%2' current moon separation (%1 degrees) is lower than minimum constraint (%3 " | 3310 | appendLogText(i18n("Job '%2' current moon separation (%1 degrees) is lower than minimum constraint (%3 " | ||
3316 | "degrees), marking aborted.", | 3311 | "degrees), marking aborted.", | ||
3317 | moonSeparation, currentJob->getName(), currentJob->getMinMoonSeparation())); | 3312 | moonSeparation, currentJob->getName(), currentJob->getMinMoonSeparation())); | ||
3318 | 3313 | | |||
3319 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | 3314 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | ||
3320 | stopCurrentJobAction(); | 3315 | stopCurrentJobAction(); | ||
3321 | stopGuiding(); | | |||
3322 | findNextJob(); | 3316 | findNextJob(); | ||
3323 | return; | 3317 | return; | ||
3324 | } | 3318 | } | ||
3325 | } | 3319 | } | ||
3326 | } | 3320 | } | ||
3327 | 3321 | | |||
3328 | // #4 Check if we're not at dawn | 3322 | // #4 Check if we're not at dawn | ||
3329 | if (currentJob->getEnforceTwilight() && now > KStarsDateTime(preDawnDateTime)) | 3323 | if (currentJob->getEnforceTwilight() && now > KStarsDateTime(preDawnDateTime)) | ||
3330 | { | 3324 | { | ||
3331 | // If either mount or dome are not parked, we shutdown if we approach dawn | 3325 | // If either mount or dome are not parked, we shutdown if we approach dawn | ||
3332 | if (isMountParked() == false || (parkDomeCheck->isEnabled() && isDomeParked() == false)) | 3326 | if (isMountParked() == false || (parkDomeCheck->isEnabled() && isDomeParked() == false)) | ||
3333 | { | 3327 | { | ||
3334 | // Minute is a DOUBLE value, do not use i18np | 3328 | // Minute is a DOUBLE value, do not use i18np | ||
3335 | appendLogText(i18n( | 3329 | appendLogText(i18n( | ||
3336 | "Job '%3' is now approaching astronomical twilight rise limit at %1 (%2 minutes safety margin), marking aborted.", | 3330 | "Job '%3' is now approaching astronomical twilight rise limit at %1 (%2 minutes safety margin), marking aborted.", | ||
3337 | preDawnDateTime.toString(), Options::preDawnTime(), currentJob->getName())); | 3331 | preDawnDateTime.toString(), Options::preDawnTime(), currentJob->getName())); | ||
3338 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | 3332 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | ||
3339 | stopCurrentJobAction(); | 3333 | stopCurrentJobAction(); | ||
3340 | stopGuiding(); | | |||
3341 | findNextJob(); | 3334 | findNextJob(); | ||
3342 | return; | 3335 | return; | ||
3343 | } | 3336 | } | ||
3344 | } | 3337 | } | ||
3345 | 3338 | | |||
3346 | // #5 Check system status to improve robustness | 3339 | // #5 Check system status to improve robustness | ||
3347 | // This handles external events such as disconnections or end-user manipulating INDI panel | 3340 | // This handles external events such as disconnections or end-user manipulating INDI panel | ||
3348 | if (!checkStatus()) | 3341 | if (!checkStatus()) | ||
▲ Show 20 Lines • Show All 506 Lines • ▼ Show 20 Line(s) | 3840 | { | |||
3855 | case SchedulerJob::STAGE_FOCUSING: | 3848 | case SchedulerJob::STAGE_FOCUSING: | ||
3856 | focusInterface->call(QDBus::AutoDetect, "abort"); | 3849 | focusInterface->call(QDBus::AutoDetect, "abort"); | ||
3857 | break; | 3850 | break; | ||
3858 | 3851 | | |||
3859 | case SchedulerJob::STAGE_ALIGNING: | 3852 | case SchedulerJob::STAGE_ALIGNING: | ||
3860 | alignInterface->call(QDBus::AutoDetect, "abort"); | 3853 | alignInterface->call(QDBus::AutoDetect, "abort"); | ||
3861 | break; | 3854 | break; | ||
3862 | 3855 | | |||
3863 | //case SchedulerJob::STAGE_CALIBRATING: | | |||
3864 | // guideInterface->call(QDBus::AutoDetect,"stopCalibration"); | | |||
3865 | // break; | | |||
3866 | | ||||
3867 | case SchedulerJob::STAGE_GUIDING: | | |||
3868 | stopGuiding(); | | |||
3869 | break; | | |||
3870 | | ||||
3871 | case SchedulerJob::STAGE_CAPTURING: | 3856 | case SchedulerJob::STAGE_CAPTURING: | ||
3872 | captureInterface->call(QDBus::AutoDetect, "abort"); | 3857 | captureInterface->call(QDBus::AutoDetect, "abort"); | ||
3873 | //stopGuiding(); | | |||
3874 | break; | 3858 | break; | ||
3875 | 3859 | | |||
3876 | default: | 3860 | default: | ||
3877 | break; | 3861 | break; | ||
3878 | } | 3862 | } | ||
3879 | 3863 | | |||
3880 | /* Reset interrupted job stage */ | 3864 | /* Reset interrupted job stage */ | ||
3881 | currentJob->setStage(SchedulerJob::STAGE_IDLE); | 3865 | currentJob->setStage(SchedulerJob::STAGE_IDLE); | ||
3882 | } | 3866 | } | ||
3867 | | ||||
3868 | /* Guiding being a parallel process, check to stop it */ | ||||
3869 | stopGuiding(); | ||||
mutlaqja: This is not executed in many blocks above where it was removed. | |||||
Agreed, but it was systematically executed after stopCurrentJobAction. This is therefore some kind of refactoring. TallFurryMan: Agreed, but it was systematically executed after stopCurrentJobAction. This is therefore some… | |||||
3883 | } | 3870 | } | ||
3884 | 3871 | | |||
3885 | bool Scheduler::manageConnectionLoss() | 3872 | bool Scheduler::manageConnectionLoss() | ||
3886 | { | 3873 | { | ||
3887 | if (SCHEDULER_RUNNING != state) | 3874 | if (SCHEDULER_RUNNING != state) | ||
3888 | return false; | 3875 | return false; | ||
3889 | 3876 | | |||
3890 | // Don't manage loss if Ekos is actually down in the state machine | 3877 | // Don't manage loss if Ekos is actually down in the state machine | ||
Show All 31 Lines | 3907 | { | |||
3922 | qCDebug(KSTARS_EKOS_SCHEDULER) << QString("INDI is currently connected, no connection loss mitigation needed."); | 3909 | qCDebug(KSTARS_EKOS_SCHEDULER) << QString("INDI is currently connected, no connection loss mitigation needed."); | ||
3923 | return false; | 3910 | return false; | ||
3924 | } | 3911 | } | ||
3925 | } | 3912 | } | ||
3926 | 3913 | | |||
3927 | // Stop actions of the current job | 3914 | // Stop actions of the current job | ||
3928 | stopCurrentJobAction(); | 3915 | stopCurrentJobAction(); | ||
3929 | 3916 | | |||
3930 | // Stop guiding, in case we are using it | | |||
3931 | stopGuiding(); | | |||
3932 | | ||||
3933 | // Acknowledge INDI and Ekos disconnections | 3917 | // Acknowledge INDI and Ekos disconnections | ||
3934 | disconnectINDI(); | 3918 | disconnectINDI(); | ||
3935 | stopEkos(); | 3919 | stopEkos(); | ||
3936 | 3920 | | |||
3937 | // Let the Scheduler attempt to connect INDI again | 3921 | // Let the Scheduler attempt to connect INDI again | ||
3938 | return true; | 3922 | return true; | ||
3939 | } | 3923 | } | ||
3940 | 3924 | | |||
▲ Show 20 Lines • Show All 464 Lines • ▼ Show 20 Line(s) | 4274 | { | |||
4405 | 4389 | | |||
4406 | appendLogText(i18n("Scheduler list saved to %1", fileURL.toLocalFile())); | 4390 | appendLogText(i18n("Scheduler list saved to %1", fileURL.toLocalFile())); | ||
4407 | file.close(); | 4391 | file.close(); | ||
4408 | return true; | 4392 | return true; | ||
4409 | } | 4393 | } | ||
4410 | 4394 | | |||
4411 | void Scheduler::startSlew() | 4395 | void Scheduler::startSlew() | ||
4412 | { | 4396 | { | ||
4413 | Q_ASSERT(currentJob != nullptr); | 4397 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting slewing must be valid"); | ||
4414 | 4398 | | |||
4415 | // If the mount was parked by a pause or the end-user, unpark | 4399 | // If the mount was parked by a pause or the end-user, unpark | ||
4416 | if (isMountParked()) | 4400 | if (isMountParked()) | ||
4417 | { | 4401 | { | ||
4418 | parkWaitState = PARKWAIT_UNPARK; | 4402 | parkWaitState = PARKWAIT_UNPARK; | ||
4419 | return; | 4403 | return; | ||
4420 | } | 4404 | } | ||
4421 | 4405 | | |||
Show All 16 Lines | |||||
4438 | { | 4422 | { | ||
4439 | currentJob->setStage(SchedulerJob::STAGE_SLEWING); | 4423 | currentJob->setStage(SchedulerJob::STAGE_SLEWING); | ||
4440 | appendLogText(i18n("Job '%1' is slewing to target.", currentJob->getName())); | 4424 | appendLogText(i18n("Job '%1' is slewing to target.", currentJob->getName())); | ||
4441 | } | 4425 | } | ||
4442 | } | 4426 | } | ||
4443 | 4427 | | |||
4444 | void Scheduler::startFocusing() | 4428 | void Scheduler::startFocusing() | ||
4445 | { | 4429 | { | ||
4430 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting focusing must be valid"); | ||||
4431 | | ||||
4446 | // 2017-09-30 Jasem: We're skipping post align focusing now as it can be performed | 4432 | // 2017-09-30 Jasem: We're skipping post align focusing now as it can be performed | ||
4447 | // when first focus request is made in capture module | 4433 | // when first focus request is made in capture module | ||
4448 | if (currentJob->getStage() == SchedulerJob::STAGE_RESLEWING_COMPLETE || | 4434 | if (currentJob->getStage() == SchedulerJob::STAGE_RESLEWING_COMPLETE || | ||
4449 | currentJob->getStage() == SchedulerJob::STAGE_POSTALIGN_FOCUSING) | 4435 | currentJob->getStage() == SchedulerJob::STAGE_POSTALIGN_FOCUSING) | ||
4450 | { | 4436 | { | ||
4451 | // Clear the HFR limit value set in the capture module | 4437 | // Clear the HFR limit value set in the capture module | ||
4452 | captureInterface->call(QDBus::AutoDetect, "clearAutoFocusHFR"); | 4438 | captureInterface->call(QDBus::AutoDetect, "clearAutoFocusHFR"); | ||
4453 | // Reset Focus frame so that next frame take a full-resolution capture first. | 4439 | // Reset Focus frame so that next frame take a full-resolution capture first. | ||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 4606 | { | |||
4633 | /* Re-evaluate all jobs, without selecting a new job */ | 4619 | /* Re-evaluate all jobs, without selecting a new job */ | ||
4634 | jobEvaluationOnly = true; | 4620 | jobEvaluationOnly = true; | ||
4635 | evaluateJobs(); | 4621 | evaluateJobs(); | ||
4636 | 4622 | | |||
4637 | /* If current job is actually complete because of previous duplicates, prepare for next job */ | 4623 | /* If current job is actually complete because of previous duplicates, prepare for next job */ | ||
4638 | if (currentJob == nullptr || currentJob->getRepeatsRemaining() == 0) | 4624 | if (currentJob == nullptr || currentJob->getRepeatsRemaining() == 0) | ||
4639 | { | 4625 | { | ||
4640 | stopCurrentJobAction(); | 4626 | stopCurrentJobAction(); | ||
4641 | stopGuiding(); | | |||
4642 | 4627 | | |||
4643 | if (currentJob != nullptr) | 4628 | if (currentJob != nullptr) | ||
4644 | { | 4629 | { | ||
4645 | appendLogText(i18np("Job '%1' is complete after #%2 batch.", | 4630 | appendLogText(i18np("Job '%1' is complete after #%2 batch.", | ||
4646 | "Job '%1' is complete after #%2 batches.", | 4631 | "Job '%1' is complete after #%2 batches.", | ||
4647 | currentJob->getName(), currentJob->getRepeatsRequired())); | 4632 | currentJob->getName(), currentJob->getRepeatsRequired())); | ||
4648 | setCurrentJob(nullptr); | 4633 | setCurrentJob(nullptr); | ||
4649 | } | 4634 | } | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
4703 | { | 4688 | { | ||
4704 | if (KStarsData::Instance()->lt().secsTo(currentJob->getCompletionTime()) <= 0) | 4689 | if (KStarsData::Instance()->lt().secsTo(currentJob->getCompletionTime()) <= 0) | ||
4705 | { | 4690 | { | ||
4706 | /* Mark the job idle as well as all its duplicates for re-evaluation */ | 4691 | /* Mark the job idle as well as all its duplicates for re-evaluation */ | ||
4707 | foreach(SchedulerJob *a_job, jobs) | 4692 | foreach(SchedulerJob *a_job, jobs) | ||
4708 | if (a_job == currentJob || a_job->isDuplicateOf(currentJob)) | 4693 | if (a_job == currentJob || a_job->isDuplicateOf(currentJob)) | ||
4709 | a_job->setState(SchedulerJob::JOB_IDLE); | 4694 | a_job->setState(SchedulerJob::JOB_IDLE); | ||
4710 | stopCurrentJobAction(); | 4695 | stopCurrentJobAction(); | ||
4711 | stopGuiding(); | 4696 | | ||
4712 | captureBatch = 0; | 4697 | captureBatch = 0; | ||
4713 | 4698 | | |||
4714 | appendLogText(i18np("Job '%1' stopping, reached completion time with #%2 batch done.", | 4699 | appendLogText(i18np("Job '%1' stopping, reached completion time with #%2 batch done.", | ||
4715 | "Job '%1' stopping, reached completion time with #%2 batches done.", | 4700 | "Job '%1' stopping, reached completion time with #%2 batches done.", | ||
4716 | currentJob->getName(), captureBatch + 1)); | 4701 | currentJob->getName(), captureBatch + 1)); | ||
4717 | 4702 | | |||
4718 | // Always reset job stage | 4703 | // Always reset job stage | ||
4719 | currentJob->setStage(SchedulerJob::STAGE_IDLE); | 4704 | currentJob->setStage(SchedulerJob::STAGE_IDLE); | ||
Show All 26 Lines | 4725 | { | |||
4746 | 4731 | | |||
4747 | setCurrentJob(nullptr); | 4732 | setCurrentJob(nullptr); | ||
4748 | schedulerTimer.start(); | 4733 | schedulerTimer.start(); | ||
4749 | } | 4734 | } | ||
4750 | } | 4735 | } | ||
4751 | 4736 | | |||
4752 | void Scheduler::startAstrometry() | 4737 | void Scheduler::startAstrometry() | ||
4753 | { | 4738 | { | ||
4739 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting aligning must be valid"); | ||||
4740 | | ||||
4754 | QDBusMessage reply; | 4741 | QDBusMessage reply; | ||
4755 | setSolverAction(Align::GOTO_SLEW); | 4742 | setSolverAction(Align::GOTO_SLEW); | ||
4756 | 4743 | | |||
4757 | // Always turn update coords on | 4744 | // Always turn update coords on | ||
4758 | //QVariant arg(true); | 4745 | //QVariant arg(true); | ||
4759 | //alignInterface->call(QDBus::AutoDetect, "setUpdateCoords", arg); | 4746 | //alignInterface->call(QDBus::AutoDetect, "setUpdateCoords", arg); | ||
4760 | 4747 | | |||
4761 | // If FITS file is specified, then we use load and slew | 4748 | // If FITS file is specified, then we use load and slew | ||
Show All 29 Lines | |||||
4791 | 4778 | | |||
4792 | /* FIXME: not supposed to modify the job */ | 4779 | /* FIXME: not supposed to modify the job */ | ||
4793 | currentJob->setStage(SchedulerJob::STAGE_ALIGNING); | 4780 | currentJob->setStage(SchedulerJob::STAGE_ALIGNING); | ||
4794 | currentOperationTime.restart(); | 4781 | currentOperationTime.restart(); | ||
4795 | } | 4782 | } | ||
4796 | 4783 | | |||
4797 | void Scheduler::startGuiding(bool resetCalibration) | 4784 | void Scheduler::startGuiding(bool resetCalibration) | ||
4798 | { | 4785 | { | ||
4786 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting guiding must be valid"); | ||||
4787 | | ||||
4799 | // avoid starting the guider twice | 4788 | // avoid starting the guider twice | ||
4800 | if (resetCalibration == false && getGuidingStatus() == GUIDE_GUIDING) | 4789 | if (resetCalibration == false && getGuidingStatus() == GUIDE_GUIDING) | ||
4801 | { | 4790 | { | ||
4802 | appendLogText(i18n("Guiding already running for %1 ...", currentJob->getName())); | 4791 | appendLogText(i18n("Guiding already running for %1 ...", currentJob->getName())); | ||
4803 | currentJob->setStage(SchedulerJob::STAGE_GUIDING); | 4792 | currentJob->setStage(SchedulerJob::STAGE_GUIDING); | ||
4804 | currentOperationTime.restart(); | 4793 | currentOperationTime.restart(); | ||
4805 | return; | 4794 | return; | ||
4806 | } | 4795 | } | ||
Show All 16 Lines | |||||
4823 | 4812 | | |||
4824 | appendLogText(i18n("Starting guiding procedure for %1 ...", currentJob->getName())); | 4813 | appendLogText(i18n("Starting guiding procedure for %1 ...", currentJob->getName())); | ||
4825 | 4814 | | |||
4826 | currentOperationTime.restart(); | 4815 | currentOperationTime.restart(); | ||
4827 | } | 4816 | } | ||
4828 | 4817 | | |||
4829 | void Scheduler::startCapture(bool restart) | 4818 | void Scheduler::startCapture(bool restart) | ||
4830 | { | 4819 | { | ||
4820 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting capturing must be valid"); | ||||
4821 | | ||||
4831 | captureInterface->setProperty("targetName", currentJob->getName().replace(' ', "")); | 4822 | captureInterface->setProperty("targetName", currentJob->getName().replace(' ', "")); | ||
4832 | 4823 | | |||
4833 | QString url = currentJob->getSequenceFile().toLocalFile(); | 4824 | QString url = currentJob->getSequenceFile().toLocalFile(); | ||
4834 | 4825 | | |||
4835 | if (restart == false) | 4826 | if (restart == false) | ||
4836 | { | 4827 | { | ||
4837 | QList<QVariant> dbusargs; | 4828 | QList<QVariant> dbusargs; | ||
4838 | dbusargs.append(url); | 4829 | dbusargs.append(url); | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 4879 | #endif | |||
4900 | else | 4891 | else | ||
4901 | appendLogText(i18n("Job '%1' capture is in progress...", currentJob->getName())); | 4892 | appendLogText(i18n("Job '%1' capture is in progress...", currentJob->getName())); | ||
4902 | 4893 | | |||
4903 | currentOperationTime.restart(); | 4894 | currentOperationTime.restart(); | ||
4904 | } | 4895 | } | ||
4905 | 4896 | | |||
4906 | void Scheduler::stopGuiding() | 4897 | void Scheduler::stopGuiding() | ||
4907 | { | 4898 | { | ||
4899 | // Tell guider to abort if the current job requires guiding - end-user may enable guiding manually before observation | ||||
4908 | if (nullptr != currentJob && (currentJob->getStepPipeline() & SchedulerJob::USE_GUIDE)) | 4900 | if (nullptr != currentJob && (currentJob->getStepPipeline() & SchedulerJob::USE_GUIDE)) | ||
4909 | { | 4901 | { | ||
4910 | switch (currentJob->getStage()) | | |||
4911 | { | | |||
4912 | case SchedulerJob::STAGE_GUIDING_COMPLETE: | | |||
4913 | case SchedulerJob::STAGE_CAPTURING: | | |||
4914 | qCInfo(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' is stopping guiding...").arg(currentJob->getName()); | 4902 | qCInfo(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' is stopping guiding...").arg(currentJob->getName()); | ||
4915 | guideInterface->call(QDBus::AutoDetect, "abort"); | 4903 | guideInterface->call(QDBus::AutoDetect, "abort"); | ||
4916 | guideFailureCount = 0; | 4904 | guideFailureCount = 0; | ||
4917 | break; | | |||
4918 | | ||||
4919 | default: | | |||
4920 | break; | | |||
4921 | } | | |||
4922 | } | 4905 | } | ||
4906 | | ||||
4907 | // In any case, stop the automatic guider restart | ||||
4908 | if (restartGuidingTimer.isActive()) | ||||
4909 | restartGuidingTimer.stop(); | ||||
4923 | } | 4910 | } | ||
4924 | 4911 | | |||
4925 | void Scheduler::setSolverAction(Align::GotoMode mode) | 4912 | void Scheduler::setSolverAction(Align::GotoMode mode) | ||
4926 | { | 4913 | { | ||
4927 | QVariant gotoMode(static_cast<int>(mode)); | 4914 | QVariant gotoMode(static_cast<int>(mode)); | ||
4928 | alignInterface->call(QDBus::AutoDetect, "setSolverAction", gotoMode); | 4915 | alignInterface->call(QDBus::AutoDetect, "setSolverAction", gotoMode); | ||
4929 | } | 4916 | } | ||
4930 | 4917 | | |||
▲ Show 20 Lines • Show All 2300 Lines • ▼ Show 20 Line(s) | 7159 | { | |||
7231 | // Shutdown scheduler if it was started and not already in shutdown | 7218 | // Shutdown scheduler if it was started and not already in shutdown | ||
7232 | if (weatherStatus == ISD::Weather::WEATHER_ALERT && state != Ekos::SCHEDULER_IDLE && state != Ekos::SCHEDULER_SHUTDOWN) | 7219 | if (weatherStatus == ISD::Weather::WEATHER_ALERT && state != Ekos::SCHEDULER_IDLE && state != Ekos::SCHEDULER_SHUTDOWN) | ||
7233 | { | 7220 | { | ||
7234 | appendLogText(i18n("Starting shutdown procedure due to severe weather.")); | 7221 | appendLogText(i18n("Starting shutdown procedure due to severe weather.")); | ||
7235 | if (currentJob) | 7222 | if (currentJob) | ||
7236 | { | 7223 | { | ||
7237 | currentJob->setState(SchedulerJob::JOB_ABORTED); | 7224 | currentJob->setState(SchedulerJob::JOB_ABORTED); | ||
7238 | stopCurrentJobAction(); | 7225 | stopCurrentJobAction(); | ||
7239 | stopGuiding(); | 7226 | | ||
7240 | jobTimer.stop(); | 7227 | jobTimer.stop(); | ||
7241 | } | 7228 | } | ||
7242 | checkShutdownState(); | 7229 | checkShutdownState(); | ||
7243 | //connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), this, SLOT(checkStatus()), &Scheduler::Qt::UniqueConnection); | 7230 | //connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), this, SLOT(checkStatus()), &Scheduler::Qt::UniqueConnection); | ||
7244 | } | 7231 | } | ||
7245 | } | 7232 | } | ||
7246 | 7233 | | |||
7247 | bool Scheduler::shouldSchedulerSleep(SchedulerJob *currentJob) | 7234 | bool Scheduler::shouldSchedulerSleep(SchedulerJob *currentJob) | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
This is not executed in many blocks above where it was removed.