diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h --- a/kstars/ekos/capture/capture.h +++ b/kstars/ekos/capture/capture.h @@ -739,6 +739,9 @@ bool checkMeridianFlip(); void checkGuidingAfterFlip(); + // check if a pause has been planned + bool checkPausing(); + // Remaining Time in seconds int getJobRemainingTime(SequenceJob *job); diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp --- a/kstars/ekos/capture/capture.cpp +++ b/kstars/ekos/capture/capture.cpp @@ -420,6 +420,15 @@ void Capture::pause() { + if (m_State != CAPTURE_CAPTURING) + { + // Ensure that the pause function is only called during frame capturing + // Handling it this way is by far easier than trying to enable/disable the pause button + // Fixme: make pausing possible at all stages. This makes it necessary to separate the pausing states from CaptureState. + appendLogText(i18n("Pausing only possible while frame capture is running.")); + qCInfo(KSTARS_EKOS_CAPTURE) << "Pause button pressed while not capturing."; + return; + } pauseFunction = nullptr; m_State = CAPTURE_PAUSE_PLANNED; emit newStatus(Ekos::CAPTURE_PAUSE_PLANNED); @@ -1366,13 +1375,10 @@ bool Capture::startNextExposure() { - if (m_State == CAPTURE_PAUSE_PLANNED) + // check if pausing has been requested + if (checkPausing() == true) { pauseFunction = &Capture::startNextExposure; - appendLogText(i18n("Sequence paused.")); - secondsLabel->setText(i18n("Paused...")); - m_State = CAPTURE_PAUSED; - setMeridianFlipStage(MF_READY); return false; } @@ -1519,15 +1525,10 @@ return true; } - if (m_State == CAPTURE_PAUSE_PLANNED) + // check if pausing has been requested + if (checkPausing() == true) { pauseFunction = &Capture::setCaptureComplete; - appendLogText(i18n("Sequence paused.")); - secondsLabel->setText(i18n("Paused...")); - m_State = CAPTURE_PAUSED; - // handle a requested meridian flip - if (meridianFlipStage != MF_NONE) - setMeridianFlipStage(MF_READY); return false; } @@ -4597,6 +4598,23 @@ } } +bool Capture::checkPausing() +{ + if (m_State == CAPTURE_PAUSE_PLANNED) + { + appendLogText(i18n("Sequence paused.")); + secondsLabel->setText(i18n("Paused...")); + m_State = CAPTURE_PAUSED; + // handle a requested meridian flip + if (meridianFlipStage != MF_NONE) + setMeridianFlipStage(MF_READY); + // pause + return true; + } + // no pause + return false; +} + bool Capture::checkMeridianFlip() {