Changeset View
Standalone View
kstars/ekos/capture/capture.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | { | 51 | { | ||
52 | setupUi(this); | 52 | setupUi(this); | ||
53 | 53 | | |||
54 | qRegisterMetaType<Ekos::CaptureState>("Ekos::CaptureState"); | 54 | qRegisterMetaType<Ekos::CaptureState>("Ekos::CaptureState"); | ||
55 | qDBusRegisterMetaType<Ekos::CaptureState>(); | 55 | qDBusRegisterMetaType<Ekos::CaptureState>(); | ||
56 | 56 | | |||
57 | new CaptureAdaptor(this); | 57 | new CaptureAdaptor(this); | ||
58 | QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Capture", this); | 58 | QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Capture", this); | ||
59 | QPointer<QDBusInterface> ekosInterface = new QDBusInterface("org.kde.kstars", "/KStars/Ekos", "org.kde.kstars.Ekos", | ||||
60 | QDBusConnection::sessionBus(), this); | ||||
61 | | ||||
62 | // Connecting DBus signals | ||||
63 | connect(ekosInterface, SIGNAL(newModule(QString)), this, SLOT(registerNewModule(QString))); | ||||
64 | | ||||
65 | // ensure that the mount interface is present | ||||
66 | registerNewModule("Mount"); | ||||
mutlaqja: Why are you initializing it here and then again in registerNewModule? | |||||
I am not sure what happens, if the interface is created before the mount module has registered at the DBus. Therefore I capture both situations with this construct:
wreissenberger: I am not sure what happens, if the interface is created **before** the mount module has… | |||||
Ok, not sure if in this instance using delete(mountInterface) in registerNewModule is required to free memory? The class is a child of "this" but not sure what happens when another "new" is used without deleting the first one. mutlaqja: Ok, not sure if in this instance using delete(mountInterface) in registerNewModule is required… | |||||
67 | | ||||
59 | 68 | | |||
60 | KStarsData::Instance()->userdb()->GetAllDSLRInfos(DSLRInfos); | 69 | KStarsData::Instance()->userdb()->GetAllDSLRInfos(DSLRInfos); | ||
61 | 70 | | |||
62 | dirPath = QUrl::fromLocalFile(QDir::homePath()); | 71 | dirPath = QUrl::fromLocalFile(QDir::homePath()); | ||
63 | 72 | | |||
64 | //isAutoGuiding = false; | 73 | //isAutoGuiding = false; | ||
65 | 74 | | |||
66 | rotatorSettings.reset(new RotatorSettings(this)); | 75 | rotatorSettings.reset(new RotatorSettings(this)); | ||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Line(s) | 359 | { | |||
351 | start(); | 360 | start(); | ||
352 | } | 361 | } | ||
353 | else | 362 | else | ||
354 | { | 363 | { | ||
355 | abort(); | 364 | abort(); | ||
356 | } | 365 | } | ||
357 | } | 366 | } | ||
358 | 367 | | |||
368 | | ||||
369 | void Capture::registerNewModule(const QString &name) | ||||
370 | { | ||||
371 | if (name == "Mount") | ||||
372 | { | ||||
373 | if (mountInterface != nullptr) | ||||
374 | delete mountInterface; | ||||
375 | mountInterface = new QDBusInterface("org.kde.kstars", "/KStars/Ekos/Mount", "org.kde.kstars.Ekos.Mount", | ||||
376 | QDBusConnection::sessionBus(), this); | ||||
377 | } | ||||
378 | | ||||
379 | } | ||||
380 | | ||||
381 | | ||||
382 | | ||||
359 | void Capture::start() | 383 | void Capture::start() | ||
360 | { | 384 | { | ||
361 | if (darkSubCheck->isChecked()) | 385 | if (darkSubCheck->isChecked()) | ||
362 | { | 386 | { | ||
363 | KMessageBox::error(this, i18n("Auto dark subtract is not supported in batch mode.")); | 387 | KMessageBox::error(this, i18n("Auto dark subtract is not supported in batch mode.")); | ||
364 | return; | 388 | return; | ||
365 | } | 389 | } | ||
366 | 390 | | |||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
425 | // Scheduler will never ignore job progress and doesn't use this path | 449 | // Scheduler will never ignore job progress and doesn't use this path | ||
426 | else if (ignoreJobProgress) | 450 | else if (ignoreJobProgress) | ||
427 | { | 451 | { | ||
428 | appendLogText(i18n("Warning: option \"Always Reset Sequence When Starting\" is enabled and resets the sequence counts.")); | 452 | appendLogText(i18n("Warning: option \"Always Reset Sequence When Starting\" is enabled and resets the sequence counts.")); | ||
429 | foreach (SequenceJob *job, jobs) | 453 | foreach (SequenceJob *job, jobs) | ||
430 | job->resetStatus(); | 454 | job->resetStatus(); | ||
431 | } | 455 | } | ||
432 | 456 | | |||
433 | // Record initialHA and initialMount position when we are starting fresh | | |||
434 | // If recovering from deviation error, these values should not be recorded. | | |||
435 | // Refocus timer should not be reset on deviation error | 457 | // Refocus timer should not be reset on deviation error | ||
436 | if (m_DeviationDetected == false && m_State != CAPTURE_SUSPENDED) | 458 | if (m_DeviationDetected == false && m_State != CAPTURE_SUSPENDED) | ||
437 | { | 459 | { | ||
438 | initialHA = getCurrentHA(); | | |||
439 | qCDebug(KSTARS_EKOS_CAPTURE) << "Initial hour angle:" << initialHA; | | |||
440 | meridianFlipStage = MF_NONE; | 460 | meridianFlipStage = MF_NONE; | ||
441 | // Record initial mount coordinates that we may use later to perform a meridian flip | | |||
442 | if (currentTelescope) | | |||
443 | { | | |||
444 | double initialRA, initialDE; | | |||
445 | currentTelescope->getEqCoords(&initialRA, &initialDE); | | |||
446 | if (currentTelescope->isJ2000()) | | |||
447 | { | | |||
448 | initialMountCoords.setRA0(initialRA); | | |||
449 | initialMountCoords.setDec0(initialDE); | | |||
450 | initialMountCoords.apparentCoord(static_cast<long double>(J2000), KStars::Instance()->data()->ut().djd()); | | |||
451 | } | | |||
452 | else | | |||
453 | { | | |||
454 | initialMountCoords.setRA(initialRA); | | |||
455 | initialMountCoords.setDec(initialDE); | | |||
456 | } | | |||
457 | | ||||
458 | qCDebug(KSTARS_EKOS_CAPTURE) << "Initial mount coordinates RA:" << initialMountCoords.ra().toHMSString() | | |||
459 | << "DE:" << initialMountCoords.dec().toDMSString(); | | |||
460 | } | | |||
461 | | ||||
462 | // start timer to measure time until next forced refocus | 461 | // start timer to measure time until next forced refocus | ||
463 | startRefocusEveryNTimer(); | 462 | startRefocusEveryNTimer(); | ||
464 | } | 463 | } | ||
465 | 464 | | |||
466 | m_DeviationDetected = false; | 465 | m_DeviationDetected = false; | ||
467 | m_SpikeDetected = false; | 466 | m_SpikeDetected = false; | ||
468 | 467 | | |||
469 | ditherCounter = Options::ditherFrames(); | 468 | ditherCounter = Options::ditherFrames(); | ||
▲ Show 20 Lines • Show All 2299 Lines • ▼ Show 20 Line(s) | 2765 | // } | |||
2769 | // if the guide deviations are within our limits, we resume the sequence | 2768 | // if the guide deviations are within our limits, we resume the sequence | ||
2770 | if (meridianFlipStage == MF_GUIDING) | 2769 | if (meridianFlipStage == MF_GUIDING) | ||
2771 | { | 2770 | { | ||
2772 | double deviation_rms = sqrt(delta_ra * delta_ra + delta_dec * delta_dec); | 2771 | double deviation_rms = sqrt(delta_ra * delta_ra + delta_dec * delta_dec); | ||
2773 | // If the user didn't select any guiding deviation, we fall through | 2772 | // If the user didn't select any guiding deviation, we fall through | ||
2774 | // otherwise we can for deviation RMS | 2773 | // otherwise we can for deviation RMS | ||
2775 | if (guideDeviationCheck->isChecked() == false || deviation_rms < guideDeviation->value()) | 2774 | if (guideDeviationCheck->isChecked() == false || deviation_rms < guideDeviation->value()) | ||
2776 | { | 2775 | { | ||
2777 | initialHA = getCurrentHA(); | | |||
2778 | appendLogText(i18n("Post meridian flip calibration completed successfully.")); | 2776 | appendLogText(i18n("Post meridian flip calibration completed successfully.")); | ||
2779 | resumeSequence(); | 2777 | resumeSequence(); | ||
2780 | // N.B. Set meridian flip stage AFTER resumeSequence() always | 2778 | // N.B. Set meridian flip stage AFTER resumeSequence() always | ||
2781 | meridianFlipStage = MF_NONE; | 2779 | meridianFlipStage = MF_NONE; | ||
2782 | return; | 2780 | return; | ||
2783 | } | 2781 | } | ||
2784 | } | 2782 | } | ||
2785 | 2783 | | |||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 2964 | { | |||
2993 | else if (count == 1) | 2991 | else if (count == 1) | ||
2994 | median = filterHFRList[0]; | 2992 | median = filterHFRList[0]; | ||
2995 | 2993 | | |||
2996 | // Add 2.5% (default) to the automatic initial HFR value to allow for minute changes in HFR without need to refocus | 2994 | // Add 2.5% (default) to the automatic initial HFR value to allow for minute changes in HFR without need to refocus | ||
2997 | // in case in-sequence-focusing is used. | 2995 | // in case in-sequence-focusing is used. | ||
2998 | HFRPixels->setValue(median + (median * (Options::hFRThresholdPercentage() / 100.0))); | 2996 | HFRPixels->setValue(median + (median * (Options::hFRThresholdPercentage() / 100.0))); | ||
2999 | } | 2997 | } | ||
3000 | 2998 | | |||
2999 | SkyPoint Capture::getInitialMountCoords() const | ||||
3000 | { | ||||
3001 | QVariant const result = mountInterface->property("currentTarget"); | ||||
mutlaqja: Where is mountInterface defined? | |||||
mountInterface is defined in registerNewModule() - see line 369. The strange thing is that it is not shown as changed. Seems like the created diff does not show all changes. wreissenberger: mountInterface is defined in registerNewModule() - see line 369. The strange thing is that it… | |||||
wreissenberger: There was one commit missing in the diff | |||||
3002 | SkyPoint point = result.value<SkyPoint>(); | ||||
3003 | return point; | ||||
3004 | } | ||||
3005 | | ||||
3006 | bool Capture::executeMeridianFlip() { | ||||
3007 | | ||||
3008 | QDBusReply<bool> const reply = mountInterface->call("executeMeridianFlip"); | ||||
3009 | | ||||
3010 | if (reply.error().type() == QDBusError::NoError) | ||||
3011 | return reply.value(); | ||||
3012 | | ||||
3013 | // error occured | ||||
3014 | qCCritical(KSTARS_EKOS_CAPTURE) << QString("Warning: execute meridian flip request received DBUS error: %1").arg(QDBusError::errorString(reply.error().type())); | ||||
Is there any action that needs to be taken here? Shouldn't this abort capture? I understand the decision is pushed to caller, but the management code is missing. TallFurryMan: Is there any action that needs to be taken here? Shouldn't this abort capture? I understand the… | |||||
I tend to simply reply "false" in case of a DBus error, i.e. meridian flip has not been executed. This is not super elegant, I know, but from a DBus error I guess there is no option of recovery. And simply issuing a shutdown seems too harsh to me. wreissenberger: I tend to simply reply "false" in case of a DBus error, i.e. meridian flip has not been… | |||||
If you're not aborting, what are the consequences? Either mount is lost, and we'd better stop the procedure, or mount will continue tracking. In that situation we'd better tell the caller, be it end-user of scheduler, that something cannot be done. Scheduler is able to restart the mount connection by itself now. TallFurryMan: If you're not aborting, what are the consequences? Either mount is lost, and we'd better stop… | |||||
3015 | | ||||
3016 | return false; | ||||
3017 | } | ||||
3018 | | ||||
3001 | int Capture::getTotalFramesCount(QString signature) | 3019 | int Capture::getTotalFramesCount(QString signature) | ||
3002 | { | 3020 | { | ||
3003 | int result = 0; | 3021 | int result = 0; | ||
3004 | bool found = false; | 3022 | bool found = false; | ||
3005 | 3023 | | |||
3006 | foreach (SequenceJob *job, jobs) | 3024 | foreach (SequenceJob *job, jobs) | ||
3007 | { | 3025 | { | ||
3008 | // FIXME: this should be part of SequenceJob | 3026 | // FIXME: this should be part of SequenceJob | ||
▲ Show 20 Lines • Show All 1017 Lines • ▼ Show 20 Line(s) | 4043 | if (nvp->s == IPS_BUSY) | |||
4026 | meridianFlipStage = MF_FLIPPING; | 4044 | meridianFlipStage = MF_FLIPPING; | ||
4027 | } | 4045 | } | ||
4028 | break; | 4046 | break; | ||
4029 | 4047 | | |||
4030 | case MF_FLIPPING: | 4048 | case MF_FLIPPING: | ||
4031 | { | 4049 | { | ||
4032 | double ra, dec; | 4050 | double ra, dec; | ||
4033 | currentTelescope->getEqCoords(&ra, &dec); | 4051 | currentTelescope->getEqCoords(&ra, &dec); | ||
4034 | double diffRA = initialMountCoords.ra().Hours() - ra; | 4052 | double diffRA = getInitialMountCoords().ra().Hours() - ra; | ||
TallFurryMan: Agreed, this is the core of the change. | |||||
4035 | // If the mount is actually flipping then we should see a difference in RA | 4053 | // If the mount is actually flipping then we should see a difference in RA | ||
4036 | // which if it exceeded MF_RA_DIFF_LIMIT (4 hours) then we consider it to be | 4054 | // which if it exceeded MF_RA_DIFF_LIMIT (4 hours) then we consider it to be | ||
4037 | // undertaking the flip. Otherwise, it's not flipping and let timeout takes care of | 4055 | // undertaking the flip. Otherwise, it's not flipping and let timeout takes care of | ||
4038 | // of that | 4056 | // of that | ||
4039 | // Are there any mounts that do NOT change RA while flipping? i.e. do it silently? | 4057 | // Are there any mounts that do NOT change RA while flipping? i.e. do it silently? | ||
4040 | // Need to investigate that bit | 4058 | // Need to investigate that bit | ||
4041 | if (fabs(diffRA) > MF_RA_DIFF_LIMIT /* || nvp->s == IPS_OK*/) | 4059 | if (fabs(diffRA) > MF_RA_DIFF_LIMIT /* || nvp->s == IPS_OK*/) | ||
4042 | meridianFlipStage = MF_SLEWING; | 4060 | meridianFlipStage = MF_SLEWING; | ||
4043 | } | 4061 | } | ||
4044 | break; | 4062 | break; | ||
4045 | 4063 | | |||
4046 | case MF_SLEWING: | 4064 | case MF_SLEWING: | ||
4047 | 4065 | | |||
4048 | if (nvp->s != IPS_OK) | 4066 | if (nvp->s != IPS_OK) | ||
4049 | break; | 4067 | break; | ||
4050 | 4068 | | |||
4051 | // If dome is syncing, wait until it stops | 4069 | // If dome is syncing, wait until it stops | ||
4052 | if (dome && dome->isMoving()) | 4070 | if (dome && dome->isMoving()) | ||
4053 | break; | 4071 | break; | ||
4054 | 4072 | | |||
4055 | // We are at a new initialHA | | |||
4056 | initialHA = getCurrentHA(); | | |||
4057 | | ||||
4058 | appendLogText(i18n("Telescope completed the meridian flip.")); | 4073 | appendLogText(i18n("Telescope completed the meridian flip.")); | ||
4059 | 4074 | | |||
4060 | //KNotification::event(QLatin1String("MeridianFlipCompleted"), i18n("Meridian flip is successfully completed")); | 4075 | //KNotification::event(QLatin1String("MeridianFlipCompleted"), i18n("Meridian flip is successfully completed")); | ||
4061 | KSNotification::event(QLatin1String("MeridianFlipCompleted"), i18n("Meridian flip is successfully completed"), KSNotification::EVENT_INFO); | 4076 | KSNotification::event(QLatin1String("MeridianFlipCompleted"), i18n("Meridian flip is successfully completed"), KSNotification::EVENT_INFO); | ||
4062 | 4077 | | |||
4063 | if (resumeAlignmentAfterFlip == true) | 4078 | if (resumeAlignmentAfterFlip == true) | ||
4064 | { | 4079 | { | ||
4065 | appendLogText(i18n("Performing post flip re-alignment...")); | 4080 | appendLogText(i18n("Performing post flip re-alignment...")); | ||
Show All 37 Lines | 4112 | { | |||
4103 | 4118 | | |||
4104 | meridianFlipStage = MF_GUIDING; | 4119 | meridianFlipStage = MF_GUIDING; | ||
4105 | emit meridianFlipCompleted(); | 4120 | emit meridianFlipCompleted(); | ||
4106 | } | 4121 | } | ||
4107 | } | 4122 | } | ||
4108 | 4123 | | |||
4109 | double Capture::getCurrentHA() | 4124 | double Capture::getCurrentHA() | ||
4110 | { | 4125 | { | ||
4111 | double currentRA, currentDEC; | 4126 | QVariant HA = mountInterface->property("hourAngle"); | ||
4112 | 4127 | return HA.toDouble(); | |||
4113 | if (currentTelescope == nullptr) | 4128 | } | ||
4114 | return Ekos::INVALID_VALUE; | | |||
4115 | 4129 | | |||
4116 | if (currentTelescope->getEqCoords(¤tRA, ¤tDEC) == false) | 4130 | double Capture::getInitialHA() | ||
4117 | { | 4131 | { | ||
4118 | appendLogText(i18n("Failed to retrieve telescope coordinates. Unable to calculate telescope's hour angle.")); | 4132 | QVariant HA = mountInterface->property("initialHA"); | ||
4119 | return Ekos::INVALID_VALUE; | 4133 | return HA.toDouble(); | ||
4120 | } | 4134 | } | ||
4121 | 4135 | | |||
4122 | /* Edge case: undefined HA at poles */ | 4136 | bool Capture::slew(const SkyPoint target) | ||
4123 | if (90.0f == currentDEC || -90.0f == currentDEC) | 4137 | { | ||
4124 | return Ekos::INVALID_VALUE; | 4138 | QList<QVariant> telescopeSlew; | ||
4139 | telescopeSlew.append(target.ra().Hours()); | ||||
4140 | telescopeSlew.append(target.dec().Degrees()); | ||||
4141 | | ||||
4142 | QDBusReply<bool> const slewModeReply = mountInterface->callWithArgumentList(QDBus::AutoDetect, "slew", telescopeSlew); | ||||
4125 | 4143 | | |||
4126 | dms lst = KStarsData::Instance()->geo()->GSTtoLST(KStarsData::Instance()->clock()->utc().gst()); | 4144 | if (slewModeReply.error().type() == QDBusError::NoError) | ||
4145 | return true; | ||||
4127 | 4146 | | |||
4128 | dms ha = (lst - dms(currentRA * 15.0)); | 4147 | // error occured | ||
4129 | double HA = ha.Hours(); | 4148 | qCCritical(KSTARS_EKOS_CAPTURE) << QString("Warning: slew request received DBUS error: %1").arg(QDBusError::errorString(slewModeReply.error().type())); | ||
4130 | if (HA > 12) | 4149 | return false; | ||
4131 | HA -= 24; | | |||
4132 | return HA; | | |||
4133 | } | 4150 | } | ||
4134 | 4151 | | |||
4152 | | ||||
4135 | bool Capture::checkMeridianFlip() | 4153 | bool Capture::checkMeridianFlip() | ||
4136 | { | 4154 | { | ||
4137 | if (currentTelescope == nullptr || meridianCheck->isChecked() == false || initialHA > 0) | 4155 | if (currentTelescope == nullptr || meridianCheck->isChecked() == false || getInitialHA() > 0) | ||
4138 | return false; | 4156 | return false; | ||
4139 | 4157 | | |||
4140 | // If active job is taking flat field image at a wall source | 4158 | // If active job is taking flat field image at a wall source | ||
4141 | // then do not flip. | 4159 | // then do not flip. | ||
4142 | if (activeJob && activeJob->getFrameType() == FRAME_FLAT && activeJob->getFlatFieldSource() == SOURCE_WALL) | 4160 | if (activeJob && activeJob->getFrameType() == FRAME_FLAT && activeJob->getFlatFieldSource() == SOURCE_WALL) | ||
4143 | return false; | 4161 | return false; | ||
4144 | 4162 | | |||
4145 | double currentHA = getCurrentHA(); | 4163 | double currentHA = getCurrentHA(); | ||
Show All 21 Lines | 4171 | { | |||
4167 | // If we are autoguiding, we should resume autoguiding after flip | 4185 | // If we are autoguiding, we should resume autoguiding after flip | ||
4168 | resumeGuidingAfterFlip = (guideState == GUIDE_GUIDING); | 4186 | resumeGuidingAfterFlip = (guideState == GUIDE_GUIDING); | ||
4169 | 4187 | | |||
4170 | emit meridianFlipStarted(); | 4188 | emit meridianFlipStarted(); | ||
4171 | 4189 | | |||
4172 | // Reset frame if we need to do focusing later on | 4190 | // Reset frame if we need to do focusing later on | ||
4173 | if (isInSequenceFocus || (refocusEveryNCheck->isChecked() && getRefocusEveryNTimerElapsedSec() > 0)) | 4191 | if (isInSequenceFocus || (refocusEveryNCheck->isChecked() && getRefocusEveryNTimerElapsedSec() > 0)) | ||
4174 | emit resetFocus(); | 4192 | emit resetFocus(); | ||
4175 | 4193 | | |||
4176 | //double dec; | 4194 | if (executeMeridianFlip()) | ||
TallFurryMan: Missing management of bool return code. | |||||
4177 | //currentTelescope->getEqCoords(&initialRA, &dec); | 4195 | { | ||
4178 | currentTelescope->Slew(&initialMountCoords); | | |||
4179 | secondsLabel->setText(i18n("Meridian Flip...")); | 4196 | secondsLabel->setText(i18n("Meridian Flip...")); | ||
4180 | 4197 | | |||
4181 | retries = 0; | 4198 | retries = 0; | ||
4182 | 4199 | | |||
4183 | m_State = CAPTURE_MERIDIAN_FLIP; | 4200 | m_State = CAPTURE_MERIDIAN_FLIP; | ||
4184 | emit newStatus(Ekos::CAPTURE_MERIDIAN_FLIP); | 4201 | emit newStatus(Ekos::CAPTURE_MERIDIAN_FLIP); | ||
4185 | 4202 | | |||
4186 | QTimer::singleShot(MF_TIMER_TIMEOUT, this, &Ekos::Capture::checkMeridianFlipTimeout); | 4203 | QTimer::singleShot(MF_TIMER_TIMEOUT, this, &Ekos::Capture::checkMeridianFlipTimeout); | ||
4187 | return true; | 4204 | return true; | ||
4188 | } | 4205 | } | ||
4206 | } | ||||
4189 | 4207 | | |||
4190 | return false; | 4208 | return false; | ||
4191 | } | 4209 | } | ||
4192 | 4210 | | |||
4193 | void Capture::checkMeridianFlipTimeout() | 4211 | void Capture::checkMeridianFlipTimeout() | ||
4194 | { | 4212 | { | ||
4195 | if (meridianFlipStage == MF_NONE) | 4213 | if (meridianFlipStage == MF_NONE) | ||
4196 | return; | 4214 | return; | ||
4197 | 4215 | | |||
4198 | if (meridianFlipStage < MF_ALIGNING) | 4216 | if (meridianFlipStage < MF_ALIGNING) | ||
4199 | { | 4217 | { | ||
4200 | appendLogText(i18n("Telescope meridian flip timed out. Please make sure your mount supports meridian flip.")); | 4218 | appendLogText(i18n("Telescope meridian flip timed out. Please make sure your mount supports meridian flip.")); | ||
4201 | 4219 | | |||
4202 | if (++retries == 3) | 4220 | if (++retries == 3) | ||
4203 | { | 4221 | { | ||
4204 | //KNotification::event(QLatin1String("MeridianFlipFailed"), i18n("Meridian flip failed")); | 4222 | //KNotification::event(QLatin1String("MeridianFlipFailed"), i18n("Meridian flip failed")); | ||
4205 | KSNotification::event(QLatin1String("MeridianFlipFailed"), i18n("Meridian flip failed"), KSNotification::EVENT_ALERT); | 4223 | KSNotification::event(QLatin1String("MeridianFlipFailed"), i18n("Meridian flip failed"), KSNotification::EVENT_ALERT); | ||
4206 | abort(); | 4224 | abort(); | ||
4207 | } | 4225 | } | ||
4208 | else | 4226 | else | ||
4209 | { | 4227 | { | ||
4210 | //double dec; | 4228 | if (executeMeridianFlip()) | ||
4211 | //currentTelescope->getEqCoords(&initialRA, &dec); | | |||
4212 | //currentTelescope->Slew(initialRA, dec); | | |||
4213 | currentTelescope->Slew(&initialMountCoords); | | |||
4214 | appendLogText(i18n("Retrying meridian flip again...")); | 4229 | appendLogText(i18n("Retrying meridian flip again...")); | ||
4215 | } | 4230 | } | ||
4216 | } | 4231 | } | ||
4217 | } | 4232 | } | ||
4218 | 4233 | | |||
4219 | void Capture::checkGuideDeviationTimeout() | 4234 | void Capture::checkGuideDeviationTimeout() | ||
4220 | { | 4235 | { | ||
4221 | if (activeJob && activeJob->getStatus() == SequenceJob::JOB_ABORTED && m_DeviationDetected) | 4236 | if (activeJob && activeJob->getStatus() == SequenceJob::JOB_ABORTED && m_DeviationDetected) | ||
▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Line(s) | 4620 | { | |||
4653 | Options::setCalibrationADUValue(targetADU); | 4668 | Options::setCalibrationADUValue(targetADU); | ||
4654 | Options::setCalibrationADUValueTolerance(targetADUTolerance); | 4669 | Options::setCalibrationADUValueTolerance(targetADUTolerance); | ||
4655 | } | 4670 | } | ||
4656 | } | 4671 | } | ||
4657 | 4672 | | |||
4658 | IPState Capture::processPreCaptureCalibrationStage() | 4673 | IPState Capture::processPreCaptureCalibrationStage() | ||
4659 | { | 4674 | { | ||
4660 | // Unpark dust cap if we have to take light images. | 4675 | // Unpark dust cap if we have to take light images. | ||
4661 | if (activeJob->getFrameType() == FRAME_LIGHT && dustCap) | 4676 | if (activeJob->getFrameType() == FRAME_LIGHT) | ||
4662 | { | 4677 | { | ||
4678 | // step 1: unpark dust cap | ||||
4679 | if (dustCap != nullptr) { | ||||
TallFurryMan: Test against nullptr? | |||||
4663 | if (dustCap->isLightOn() == true) | 4680 | if (dustCap->isLightOn() == true) | ||
4664 | { | 4681 | { | ||
4665 | dustCapLightEnabled = false; | 4682 | dustCapLightEnabled = false; | ||
4666 | dustCap->SetLightEnabled(false); | 4683 | dustCap->SetLightEnabled(false); | ||
4667 | } | 4684 | } | ||
4668 | 4685 | | |||
4669 | // If cap is not unparked, unpark it | 4686 | // If cap is not unparked, unpark it | ||
4670 | if (calibrationStage < CAL_DUSTCAP_UNPARKING && dustCap->isParked()) | 4687 | if (calibrationStage < CAL_DUSTCAP_UNPARKING && dustCap->isParked()) | ||
Show All 18 Lines | 4705 | { | |||
4689 | if (dustCap->isUnParked() == false) | 4706 | if (dustCap->isUnParked() == false) | ||
4690 | return IPS_BUSY; | 4707 | return IPS_BUSY; | ||
4691 | else | 4708 | else | ||
4692 | { | 4709 | { | ||
4693 | calibrationStage = CAL_DUSTCAP_UNPARKED; | 4710 | calibrationStage = CAL_DUSTCAP_UNPARKED; | ||
4694 | appendLogText(i18n("Dust cap unparked.")); | 4711 | appendLogText(i18n("Dust cap unparked.")); | ||
4695 | } | 4712 | } | ||
4696 | } | 4713 | } | ||
4714 | } | ||||
4715 | | ||||
4716 | // step 2: check if meridian flip is required | ||||
4717 | if (meridianFlipStage != MF_NONE || checkMeridianFlip()) | ||||
4718 | return IPS_BUSY; | ||||
4697 | 4719 | | |||
4698 | calibrationStage = CAL_PRECAPTURE_COMPLETE; | 4720 | calibrationStage = CAL_PRECAPTURE_COMPLETE; | ||
4699 | 4721 | | |||
4700 | if (guideState == GUIDE_SUSPENDED) | 4722 | if (guideState == GUIDE_SUSPENDED) | ||
4701 | { | 4723 | { | ||
4702 | appendLogText(i18n("Autoguiding resumed.")); | 4724 | appendLogText(i18n("Autoguiding resumed.")); | ||
4703 | emit resumeGuiding(); | 4725 | emit resumeGuiding(); | ||
4704 | } | 4726 | } | ||
▲ Show 20 Lines • Show All 1011 Lines • Show Last 20 Lines |
Why are you initializing it here and then again in registerNewModule?