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 2145 Lines • ▼ Show 20 Line(s) | 1750 | { | |||
---|---|---|---|---|---|
2146 | if (SchedulerJob::JOB_EVALUATION == currentJob->getState()) | 2146 | if (SchedulerJob::JOB_EVALUATION == currentJob->getState()) | ||
2147 | { | 2147 | { | ||
2148 | currentJob->setState(SchedulerJob::JOB_INVALID); | 2148 | currentJob->setState(SchedulerJob::JOB_INVALID); | ||
2149 | 2149 | | |||
2150 | //appendLogText(i18n("Warning: job '%1' on row #%2 could not be scheduled during evaluation and is marked invalid, please review your plan.", | 2150 | //appendLogText(i18n("Warning: job '%1' on row #%2 could not be scheduled during evaluation and is marked invalid, please review your plan.", | ||
2151 | // currentJob->getName(), | 2151 | // currentJob->getName(), | ||
2152 | // index + 1)); | 2152 | // index + 1)); | ||
2153 | 2153 | | |||
2154 | #if 0 | | |||
TallFurryMan: Thus advice block is actually sound, but there was not enough tests done to include it. | |||||
2155 | // Advices | | |||
2156 | if (-90 < currentJob->getMinAltitude()) | | |||
2157 | appendLogText(i18n("Job '%1' may require relaxing the current altitude requirement of %2 degrees.", | | |||
2158 | currentJob->getName(), | | |||
2159 | QString("%L1").arg(static_cast<double>(currentJob->getMinAltitude()), 0, 'f', minAltitude->decimals))); | | |||
2160 | | ||||
2161 | if (SchedulerJob::START_CULMINATION == currentJob->getFileStartupCondition() && Options::leadTime() < 5) | | |||
2162 | appendLogText(i18n("Job '%1' may require increasing the current lead time of %2 minutes to make transit time calculation stable.", | | |||
2163 | currentJob->getName(), | | |||
2164 | Options::leadTime())); | | |||
2165 | #endif | | |||
2166 | } | 2154 | } | ||
2167 | } | 2155 | } | ||
2168 | 2156 | | |||
2169 | /* Apply sorting to queue table, and mark it for saving if it changes */ | 2157 | /* Apply sorting to queue table, and mark it for saving if it changes */ | ||
2170 | mDirty = reorderJobs(sortedJobs) | mDirty; | 2158 | mDirty = reorderJobs(sortedJobs) | mDirty; | ||
2171 | 2159 | | |||
2172 | if (jobEvaluationOnly || state != SCHEDULER_RUNNING) | 2160 | if (jobEvaluationOnly || state != SCHEDULER_RUNNING) | ||
2173 | { | 2161 | { | ||
▲ Show 20 Lines • Show All 528 Lines • ▼ Show 20 Line(s) | 2684 | { | |||
2702 | } | 2690 | } | ||
2703 | else | 2691 | else | ||
2704 | qCWarning(KSTARS_EKOS_SCHEDULER) << "Capture module is not ready yet..."; | 2692 | qCWarning(KSTARS_EKOS_SCHEDULER) << "Capture module is not ready yet..."; | ||
2705 | } | 2693 | } | ||
2706 | 2694 | | |||
2707 | indiState = INDI_READY; | 2695 | indiState = INDI_READY; | ||
2708 | indiConnectFailureCount = 0; | 2696 | indiConnectFailureCount = 0; | ||
2709 | return true; | 2697 | return true; | ||
2710 | | ||||
2711 | #if 0 | | |||
TallFurryMan: OK this is code that was moved. | |||||
2712 | // Check if mount and dome support parking or not. | | |||
2713 | QDBusReply<bool> boolReply = mountInterface->call(QDBus::AutoDetect, "canPark"); | | |||
2714 | unparkMountCheck->setEnabled(boolReply.value()); | | |||
2715 | parkMountCheck->setEnabled(boolReply.value()); | | |||
2716 | | ||||
2717 | //qDebug() << "Mount can park " << boolReply.value(); | | |||
2718 | | ||||
2719 | boolReply = domeInterface->call(QDBus::AutoDetect, "canPark"); | | |||
2720 | unparkDomeCheck->setEnabled(boolReply.value()); | | |||
2721 | parkDomeCheck->setEnabled(boolReply.value()); | | |||
2722 | | ||||
2723 | boolReply = captureInterface->call(QDBus::AutoDetect, "hasCoolerControl"); | | |||
2724 | warmCCDCheck->setEnabled(boolReply.value()); | | |||
2725 | | ||||
2726 | QDBusReply<int> updateReply = weatherInterface->call(QDBus::AutoDetect, "getUpdatePeriod"); | | |||
2727 | if (updateReply.error().type() == QDBusError::NoError) | | |||
2728 | { | | |||
2729 | weatherCheck->setEnabled(true); | | |||
2730 | if (updateReply.value() > 0) | | |||
2731 | { | | |||
2732 | weatherTimer.setInterval(updateReply.value() * 1000); | | |||
2733 | connect(&weatherTimer, &QTimer::timeout, this, &Scheduler::checkWeather); | | |||
2734 | weatherTimer.start(); | | |||
2735 | | ||||
2736 | // Check weather initially | | |||
2737 | checkWeather(); | | |||
2738 | } | | |||
2739 | } | | |||
2740 | else | | |||
2741 | weatherCheck->setEnabled(false); | | |||
2742 | | ||||
2743 | QDBusReply<bool> capReply = capInterface->call(QDBus::AutoDetect, "canPark"); | | |||
2744 | if (capReply.error().type() == QDBusError::NoError) | | |||
2745 | { | | |||
2746 | capCheck->setEnabled(capReply.value()); | | |||
2747 | uncapCheck->setEnabled(capReply.value()); | | |||
2748 | } | | |||
2749 | else | | |||
2750 | { | | |||
2751 | capCheck->setEnabled(false); | | |||
2752 | uncapCheck->setEnabled(false); | | |||
2753 | } | | |||
2754 | | ||||
2755 | indiState = INDI_READY; | | |||
2756 | return true; | | |||
2757 | #endif | | |||
2758 | } | 2698 | } | ||
2759 | 2699 | | |||
2760 | case INDI_READY: | 2700 | case INDI_READY: | ||
2761 | return true; | 2701 | return true; | ||
2762 | } | 2702 | } | ||
2763 | 2703 | | |||
2764 | return false; | 2704 | return false; | ||
2765 | } | 2705 | } | ||
▲ Show 20 Lines • Show All 733 Lines • ▼ Show 20 Line(s) | 3435 | { | |||
3499 | return; | 3439 | return; | ||
3500 | } | 3440 | } | ||
3501 | 3441 | | |||
3502 | if (!isDomeMoving.value<bool>()) | 3442 | if (!isDomeMoving.value<bool>()) | ||
3503 | getNextAction(); | 3443 | getNextAction(); | ||
3504 | } | 3444 | } | ||
3505 | else getNextAction(); | 3445 | else getNextAction(); | ||
3506 | break; | 3446 | break; | ||
3507 | #if 0 | | |||
TallFurryMan: OK this is code that was moved. | |||||
3508 | case SchedulerJob::STAGE_FOCUSING: | | |||
3509 | { | | |||
3510 | QDBusReply<int> focusReply = focusInterface->call(QDBus::AutoDetect, "getStatus"); | | |||
3511 | | ||||
3512 | if (focusReply.error().type() == QDBusError::UnknownObject) | | |||
3513 | { | | |||
3514 | appendLogText(i18n("Warning: job '%1' lost connection to INDI server while focusing, attempting to reconnect.", currentJob->getName())); | | |||
3515 | if (!manageConnectionLoss()) | | |||
3516 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3517 | return; | | |||
3518 | } | | |||
3519 | | ||||
3520 | qCDebug(KSTARS_EKOS_SCHEDULER) << "Focus stage..."; | | |||
3521 | | ||||
3522 | Ekos::FocusState focusStatus = static_cast<Ekos::FocusState>(focusReply.value()); | | |||
3523 | | ||||
3524 | // Is focus complete? | | |||
3525 | if (focusStatus == Ekos::FOCUS_COMPLETE) | | |||
3526 | { | | |||
3527 | appendLogText(i18n("Job '%1' focusing is complete.", currentJob->getName())); | | |||
3528 | | ||||
3529 | autofocusCompleted = true; | | |||
3530 | | ||||
3531 | currentJob->setStage(SchedulerJob::STAGE_FOCUS_COMPLETE); | | |||
3532 | | ||||
3533 | getNextAction(); | | |||
3534 | } | | |||
3535 | else if (focusStatus == Ekos::FOCUS_FAILED || focusStatus == Ekos::FOCUS_ABORTED) | | |||
3536 | { | | |||
3537 | appendLogText(i18n("Warning: job '%1' focusing failed.", currentJob->getName())); | | |||
3538 | | ||||
3539 | if (focusFailureCount++ < MAX_FAILURE_ATTEMPTS) | | |||
3540 | { | | |||
3541 | appendLogText(i18n("Job '%1' is restarting its focusing procedure.", currentJob->getName())); | | |||
3542 | // Reset frame to original size. | | |||
3543 | focusInterface->call(QDBus::AutoDetect, "resetFrame"); | | |||
3544 | // Restart focusing | | |||
3545 | startFocusing(); | | |||
3546 | } | | |||
3547 | else | | |||
3548 | { | | |||
3549 | appendLogText(i18n("Warning: job '%1' focusing procedure failed, marking terminated due to errors.", currentJob->getName())); | | |||
3550 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3551 | | ||||
3552 | findNextJob(); | | |||
3553 | } | | |||
3554 | } | | |||
3555 | } | | |||
3556 | break; | | |||
3557 | #endif | | |||
3558 | | ||||
3559 | /*case SchedulerJob::STAGE_POSTALIGN_FOCUSING: | | |||
3560 | focusInterface->call(QDBus::AutoDetect,"resetFrame"); | | |||
3561 | currentJob->setStage(SchedulerJob::STAGE_POSTALIGN_FOCUSING_COMPLETE); | | |||
3562 | getNextAction(); | | |||
3563 | break;*/ | | |||
3564 | | ||||
3565 | #if 0 | | |||
3566 | case SchedulerJob::STAGE_ALIGNING: | | |||
3567 | { | | |||
3568 | QDBusReply<int> alignReply; | | |||
3569 | | ||||
3570 | qCDebug(KSTARS_EKOS_SCHEDULER) << "Alignment stage..."; | | |||
3571 | | ||||
3572 | alignReply = alignInterface->call(QDBus::AutoDetect, "getStatus"); | | |||
3573 | | ||||
3574 | if (alignReply.error().type() == QDBusError::UnknownObject) | | |||
3575 | { | | |||
3576 | appendLogText(i18n("Warning: job '%1' lost connection to INDI server while aligning, attempting to reconnect.", currentJob->getName())); | | |||
3577 | if (!manageConnectionLoss()) | | |||
3578 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3579 | return; | | |||
3580 | } | | |||
3581 | | ||||
3582 | Ekos::AlignState alignStatus = static_cast<Ekos::AlignState>(alignReply.value()); | | |||
3583 | | ||||
3584 | // Is solver complete? | | |||
3585 | if (alignStatus == Ekos::ALIGN_COMPLETE) | | |||
3586 | { | | |||
3587 | appendLogText(i18n("Job '%1' alignment is complete.", currentJob->getName())); | | |||
3588 | alignFailureCount = 0; | | |||
3589 | | ||||
3590 | currentJob->setStage(SchedulerJob::STAGE_ALIGN_COMPLETE); | | |||
3591 | getNextAction(); | | |||
3592 | } | | |||
3593 | else if (alignStatus == Ekos::ALIGN_FAILED || alignStatus == Ekos::ALIGN_ABORTED) | | |||
3594 | { | | |||
3595 | appendLogText(i18n("Warning: job '%1' alignment failed.", currentJob->getName())); | | |||
3596 | | ||||
3597 | if (alignFailureCount++ < MAX_FAILURE_ATTEMPTS) | | |||
3598 | { | | |||
3599 | if (Options::resetMountModelOnAlignFail() && MAX_FAILURE_ATTEMPTS - 1 < alignFailureCount) | | |||
3600 | { | | |||
3601 | appendLogText(i18n("Warning: job '%1' forcing mount model reset after failing alignment #%2.", currentJob->getName(), alignFailureCount)); | | |||
3602 | mountInterface->call(QDBus::AutoDetect, "resetModel"); | | |||
3603 | } | | |||
3604 | appendLogText(i18n("Restarting %1 alignment procedure...", currentJob->getName())); | | |||
3605 | startAstrometry(); | | |||
3606 | } | | |||
3607 | else | | |||
3608 | { | | |||
3609 | appendLogText(i18n("Warning: job '%1' alignment procedure failed, aborting job.", currentJob->getName())); | | |||
3610 | currentJob->setState(SchedulerJob::JOB_ABORTED); | | |||
3611 | | ||||
3612 | findNextJob(); | | |||
3613 | } | | |||
3614 | } | | |||
3615 | } | | |||
3616 | break; | | |||
3617 | #endif | | |||
3618 | | ||||
3619 | #if 0 | | |||
3620 | case SchedulerJob::STAGE_GUIDING: | | |||
3621 | { | | |||
3622 | QDBusReply<int> guideReply = guideInterface->call(QDBus::AutoDetect, "getStatus"); | | |||
3623 | | ||||
3624 | qCDebug(KSTARS_EKOS_SCHEDULER) << "Calibration & Guide stage..."; | | |||
3625 | | ||||
3626 | if (guideReply.error().type() == QDBusError::UnknownObject) | | |||
3627 | { | | |||
3628 | appendLogText(i18n("Warning: job '%1' lost connection to INDI server while guiding, attempting to reconnect.", currentJob->getName())); | | |||
3629 | if (!manageConnectionLoss()) | | |||
3630 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3631 | return; | | |||
3632 | } | | |||
3633 | | ||||
3634 | Ekos::GuideState guideStatus = static_cast<Ekos::GuideState>(guideReply.value()); | | |||
3635 | | ||||
3636 | // If calibration stage complete? | | |||
3637 | if (guideStatus == Ekos::GUIDE_GUIDING) | | |||
3638 | { | | |||
3639 | appendLogText(i18n("Job '%1' guiding is in progress.", currentJob->getName())); | | |||
3640 | guideFailureCount = 0; | | |||
3641 | | ||||
3642 | currentJob->setStage(SchedulerJob::STAGE_GUIDING_COMPLETE); | | |||
3643 | getNextAction(); | | |||
3644 | } | | |||
3645 | // JM 2018-07-30: GUIDE_IDLE is also a failure | | |||
3646 | else if (guideStatus == Ekos::GUIDE_CALIBRATION_ERROR || | | |||
3647 | guideStatus == Ekos::GUIDE_ABORTED) | | |||
3648 | { | | |||
3649 | if (guideStatus == Ekos::GUIDE_ABORTED) | | |||
3650 | appendLogText(i18n("Warning: job '%1' guiding failed.", currentJob->getName())); | | |||
3651 | else | | |||
3652 | appendLogText(i18n("Warning: job '%1' calibration failed.", currentJob->getName())); | | |||
3653 | | ||||
3654 | if (guideFailureCount++ < MAX_FAILURE_ATTEMPTS) | | |||
3655 | { | | |||
3656 | if (guideStatus == Ekos::GUIDE_CALIBRATION_ERROR && | | |||
3657 | Options::realignAfterCalibrationFailure()) | | |||
3658 | { | | |||
3659 | appendLogText(i18n("Restarting %1 alignment procedure...", currentJob->getName())); | | |||
3660 | // JM: We have to go back to startSlew() since if we just call startAstrometry() | | |||
3661 | // It would captureAndSolve at the _current_ coords which could be way off center if the calibration | | |||
3662 | // process took a wild ride search for a suitable guide star and then failed. So startSlew() would ensure | | |||
3663 | // we're back on our target and then it proceed to alignment (focus is skipped since it is done if it was checked anyway). | | |||
3664 | startSlew(); | | |||
3665 | } | | |||
3666 | else | | |||
3667 | { | | |||
3668 | appendLogText(i18n("Job '%1' is guiding, and is restarting its guiding procedure.", currentJob->getName())); | | |||
3669 | startGuiding(true); | | |||
3670 | } | | |||
3671 | } | | |||
3672 | else | | |||
3673 | { | | |||
3674 | appendLogText(i18n("Warning: job '%1' guiding procedure failed, marking terminated due to errors.", currentJob->getName())); | | |||
3675 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3676 | | ||||
3677 | findNextJob(); | | |||
3678 | } | | |||
3679 | } | | |||
3680 | } | | |||
3681 | break; | | |||
3682 | #endif | | |||
3683 | | ||||
3684 | #if 0 | | |||
3685 | case SchedulerJob::STAGE_CAPTURING: | | |||
3686 | { | | |||
3687 | QDBusReply<QString> captureReply = captureInterface->call(QDBus::AutoDetect, "getSequenceQueueStatus"); | | |||
3688 | | ||||
3689 | if (captureReply.error().type() == QDBusError::UnknownObject) | | |||
3690 | { | | |||
3691 | appendLogText(i18n("Warning: job '%1' lost connection to INDI server while capturing, attempting to reconnect.", currentJob->getName())); | | |||
3692 | if (!manageConnectionLoss()) | | |||
3693 | currentJob->setState(SchedulerJob::JOB_ERROR); | | |||
3694 | } | | |||
3695 | else if (captureReply.value().toStdString() == "Aborted" || captureReply.value().toStdString() == "Error") | | |||
3696 | { | | |||
3697 | appendLogText(i18n("Warning: job '%1' failed to capture target (%2).", currentJob->getName(), captureReply.value())); | | |||
3698 | | ||||
3699 | if (captureFailureCount++ < MAX_FAILURE_ATTEMPTS) | | |||
3700 | { | | |||
3701 | // If capture failed due to guiding error, let's try to restart that | | |||
3702 | if (currentJob->getStepPipeline() & SchedulerJob::USE_GUIDE) | | |||
3703 | { | | |||
3704 | // Check if it is guiding related. | | |||
3705 | QDBusReply<int> guideReply = guideInterface->call(QDBus::AutoDetect, "getStatus"); | | |||
3706 | if (guideReply.value() == Ekos::GUIDE_ABORTED || | | |||
3707 | guideReply.value() == Ekos::GUIDE_CALIBRATION_ERROR || | | |||
3708 | guideReply.value() == GUIDE_DITHERING_ERROR) | | |||
3709 | // If guiding failed, let's restart it | | |||
3710 | //if(guideReply.value() == false) | | |||
3711 | { | | |||
3712 | appendLogText(i18n("Job '%1' is capturing, and is restarting its guiding procedure.", currentJob->getName())); | | |||
3713 | //currentJob->setStage(SchedulerJob::STAGE_GUIDING); | | |||
3714 | startGuiding(true); | | |||
3715 | return; | | |||
3716 | } | | |||
3717 | } | | |||
3718 | | ||||
3719 | /* FIXME: it's not clear whether it is actually possible to continue capturing when capture fails this way */ | | |||
3720 | appendLogText(i18n("Warning: job '%1' failed its capture procedure, restarting capture.", currentJob->getName())); | | |||
3721 | startCapture(); | | |||
3722 | } | | |||
3723 | else | | |||
3724 | { | | |||
3725 | /* FIXME: it's not clear whether this situation can be recovered at all */ | | |||
3726 | appendLogText(i18n("Warning: job '%1' failed its capture procedure, marking aborted.", currentJob->getName())); | | |||
3727 | currentJob->setState(SchedulerJob::JOB_ABORTED); | | |||
3728 | | ||||
3729 | findNextJob(); | | |||
3730 | } | | |||
3731 | } | | |||
3732 | else if (captureReply.value().toStdString() == "Complete") | | |||
3733 | { | | |||
3734 | KNotification::event(QLatin1String("EkosScheduledImagingFinished"), | | |||
3735 | i18n("Ekos job (%1) - Capture finished", currentJob->getName())); | | |||
3736 | | ||||
3737 | | ||||
3738 | captureInterface->call(QDBus::AutoDetect, "clearSequenceQueue"); | | |||
3739 | | ||||
3740 | currentJob->setState(SchedulerJob::JOB_COMPLETE); | | |||
3741 | findNextJob(); | | |||
3742 | } | | |||
3743 | else | | |||
3744 | { | | |||
3745 | captureFailureCount = 0; | | |||
3746 | /* currentJob->setCompletedCount(currentJob->getCompletedCount() + 1); */ | | |||
3747 | } | | |||
3748 | } | | |||
3749 | break; | | |||
3750 | #endif | | |||
3751 | 3447 | | |||
3752 | default: | 3448 | default: | ||
3753 | break; | 3449 | break; | ||
3754 | } | 3450 | } | ||
3755 | } | 3451 | } | ||
3756 | 3452 | | |||
3757 | void Scheduler::getNextAction() | 3453 | void Scheduler::getNextAction() | ||
3758 | { | 3454 | { | ||
▲ Show 20 Lines • Show All 1074 Lines • ▼ Show 20 Line(s) | 4500 | { | |||
4833 | 4529 | | |||
4834 | currentOperationTime.restart(); | 4530 | currentOperationTime.restart(); | ||
4835 | } | 4531 | } | ||
4836 | 4532 | | |||
4837 | void Scheduler::startCapture(bool restart) | 4533 | void Scheduler::startCapture(bool restart) | ||
4838 | { | 4534 | { | ||
4839 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting capturing must be valid"); | 4535 | Q_ASSERT_X(nullptr != currentJob, __FUNCTION__, "Job starting capturing must be valid"); | ||
4840 | 4536 | | |||
4537 | // ensure that guiding is running before we start capturing | ||||
TallFurryMan: This is actually the diff. OK. | |||||
4538 | if (currentJob->getStepPipeline() & SchedulerJob::USE_GUIDE && getGuidingStatus() != GUIDE_GUIDING) | ||||
4539 | { | ||||
4540 | // guiding should run, but it doesn't. So start guiding first | ||||
4541 | currentJob->setStage(SchedulerJob::STAGE_GUIDING); | ||||
4542 | startGuiding(); | ||||
4543 | return; | ||||
4544 | } | ||||
4545 | | ||||
4546 | | ||||
4841 | captureInterface->setProperty("targetName", currentJob->getName().replace(' ', "")); | 4547 | captureInterface->setProperty("targetName", currentJob->getName().replace(' ', "")); | ||
4842 | 4548 | | |||
4843 | QString url = currentJob->getSequenceFile().toLocalFile(); | 4549 | QString url = currentJob->getSequenceFile().toLocalFile(); | ||
4844 | 4550 | | |||
4845 | if (restart == false) | 4551 | if (restart == false) | ||
4846 | { | 4552 | { | ||
4847 | QList<QVariant> dbusargs; | 4553 | QList<QVariant> dbusargs; | ||
4848 | dbusargs.append(url); | 4554 | dbusargs.append(url); | ||
4849 | captureInterface->callWithArgumentList(QDBus::AutoDetect, "loadSequenceQueue", dbusargs); | 4555 | captureInterface->callWithArgumentList(QDBus::AutoDetect, "loadSequenceQueue", dbusargs); | ||
4850 | } | 4556 | } | ||
4851 | 4557 | | |||
4852 | 4558 | | |||
4853 | switch (currentJob->getCompletionCondition()) | 4559 | switch (currentJob->getCompletionCondition()) | ||
4854 | { | 4560 | { | ||
4855 | case SchedulerJob::FINISH_LOOP: | 4561 | case SchedulerJob::FINISH_LOOP: | ||
4856 | case SchedulerJob::FINISH_AT: | 4562 | case SchedulerJob::FINISH_AT: | ||
4857 | // In these cases, we leave the captured frames map empty | 4563 | // In these cases, we leave the captured frames map empty | ||
4858 | // to ensure, that the capture sequence is executed in any case. | 4564 | // to ensure, that the capture sequence is executed in any case. | ||
4859 | break; | 4565 | break; | ||
4860 | 4566 | | |||
4861 | default: | 4567 | default: | ||
4862 | // Scheduler always sets captured frame map when starting a sequence - count may be different, robustness, dynamic priority | 4568 | // Scheduler always sets captured frame map when starting a sequence - count may be different, robustness, dynamic priority | ||
4863 | #if 0 | | |||
TallFurryMan: OK dead code. | |||||
4864 | // JM 2018-09-24: If job is looping, no need to set captured frame maps. | | |||
4865 | if (currentJob->getCompletionCondition() != SchedulerJob::FINISH_SEQUENCE) | | |||
4866 | break; | | |||
4867 | #endif | | |||
4868 | 4569 | | |||
4869 | // hand over the map of captured frames so that the capture | 4570 | // hand over the map of captured frames so that the capture | ||
4870 | // process knows about existing frames | 4571 | // process knows about existing frames | ||
4871 | SchedulerJob::CapturedFramesMap fMap = currentJob->getCapturedFramesMap(); | 4572 | SchedulerJob::CapturedFramesMap fMap = currentJob->getCapturedFramesMap(); | ||
4872 | 4573 | | |||
4873 | for (auto &e : fMap.keys()) | 4574 | for (auto &e : fMap.keys()) | ||
4874 | { | 4575 | { | ||
4875 | QList<QVariant> dbusargs; | 4576 | QList<QVariant> dbusargs; | ||
4876 | QDBusMessage reply; | 4577 | QDBusMessage reply; | ||
4877 | 4578 | | |||
4878 | dbusargs.append(e); | 4579 | dbusargs.append(e); | ||
4879 | dbusargs.append(fMap.value(e)); | 4580 | dbusargs.append(fMap.value(e)); | ||
4880 | if ((reply = captureInterface->callWithArgumentList(QDBus::AutoDetect, "setCapturedFramesMap", dbusargs)).type() == | 4581 | if ((reply = captureInterface->callWithArgumentList(QDBus::AutoDetect, "setCapturedFramesMap", dbusargs)).type() == | ||
4881 | QDBusMessage::ErrorMessage) | 4582 | QDBusMessage::ErrorMessage) | ||
4882 | { | 4583 | { | ||
4883 | qCCritical(KSTARS_EKOS_SCHEDULER) << QString("Warning: job '%1' setCapturedFramesCount request received DBUS error: %1").arg(currentJob->getName()).arg(reply.errorMessage()); | 4584 | qCCritical(KSTARS_EKOS_SCHEDULER) << QString("Warning: job '%1' setCapturedFramesCount request received DBUS error: %1").arg(currentJob->getName()).arg(reply.errorMessage()); | ||
4884 | if (!manageConnectionLoss()) | 4585 | if (!manageConnectionLoss()) | ||
4885 | currentJob->setState(SchedulerJob::JOB_ERROR); | 4586 | currentJob->setState(SchedulerJob::JOB_ERROR); | ||
4886 | return; | 4587 | return; | ||
4887 | } | 4588 | } | ||
4888 | } | 4589 | } | ||
4889 | break; | 4590 | break; | ||
4890 | } | 4591 | } | ||
4891 | 4592 | | |||
4892 | // Never ignore sequence history in the Capture module, it is unrelated to storage | | |||
TallFurryMan: OK. | |||||
4893 | #if 0 | | |||
4894 | // If sequence is a loop, ignore sequence history | | |||
4895 | // FIXME: set, but never used. | | |||
4896 | if (currentJob->getCompletionCondition() != SchedulerJob::FINISH_SEQUENCE) | | |||
4897 | captureInterface->call(QDBus::AutoDetect, "ignoreSequenceHistory"); | | |||
4898 | #endif | | |||
4899 | | ||||
4900 | // Start capture process | 4593 | // Start capture process | ||
4901 | captureInterface->call(QDBus::AutoDetect, "start"); | 4594 | captureInterface->call(QDBus::AutoDetect, "start"); | ||
4902 | 4595 | | |||
4903 | currentJob->setStage(SchedulerJob::STAGE_CAPTURING); | 4596 | currentJob->setStage(SchedulerJob::STAGE_CAPTURING); | ||
4904 | 4597 | | |||
4905 | KNotification::event(QLatin1String("EkosScheduledImagingStart"), | 4598 | KNotification::event(QLatin1String("EkosScheduledImagingStart"), | ||
4906 | i18n("Ekos job (%1) - Capture started", currentJob->getName())); | 4599 | i18n("Ekos job (%1) - Capture started", currentJob->getName())); | ||
4907 | 4600 | | |||
▲ Show 20 Lines • Show All 2458 Lines • Show Last 20 Lines |
Thus advice block is actually sound, but there was not enough tests done to include it.