summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-27 10:35:02 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-27 10:35:02 (GMT)
commiteaafa9317b3a7c31c711217521c531aabeba2d4d (patch)
tree712b5c66ebc6c21f1f279b23f560fc6eeaedc6fa
parentbef4d86e2a7762f1fbe3bdd25c52fb54fd557790 (diff)
Always reset frame when doing calibration. Use pulseTimer instead of single shot so that we can stop it on abort
-rw-r--r--kstars/ekos/guide/guide.cpp53
-rw-r--r--kstars/ekos/guide/guide.h3
2 files changed, 33 insertions, 23 deletions
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index efefb36..3500245 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -177,6 +177,9 @@ Guide::Guide() : QWidget()
connect(externalConnectB, &QPushButton::clicked, this, [&](){guider->Connect();});
connect(externalDisconnectB, &QPushButton::clicked, this, [&](){guider->Disconnect();});
+ // Pulse Timer
+ connect(&pulseTimer, SIGNAL(timeout()), this, SLOT(capture()));
+
// Drift Graph
driftGraph->setBackground(QBrush(Qt::black));
driftGraph->xAxis->setBasePen(QPen(Qt::white, 1));
@@ -634,7 +637,13 @@ bool Guide::captureOneFrame()
bool Guide::abort()
{
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
+ if (guiderType == GUIDE_INTERNAL)
+ {
+ pulseTimer.stop();
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
+ if (targetChip->isCapturing())
+ targetChip->abortExposure();
+ }
setBusy(false);
@@ -643,8 +652,6 @@ bool Guide::abort()
case GUIDE_IDLE:
case GUIDE_CONNECTED:
case GUIDE_DISCONNECTED:
- if (targetChip->isCapturing())
- targetChip->abortExposure();
break;
case GUIDE_CALIBRATING:
@@ -826,7 +833,7 @@ bool Guide::sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_d
return false;
if (state == GUIDE_CALIBRATING)
- QTimer::singleShot( (ra_msecs > dec_msecs ? ra_msecs : dec_msecs) + 100, this, SLOT(capture()));
+ pulseTimer.start( (ra_msecs > dec_msecs ? ra_msecs : dec_msecs) + 100);
return GuideDriver->doPulse(ra_dir, ra_msecs, dec_dir, dec_msecs);
}
@@ -837,7 +844,7 @@ bool Guide::sendPulse( GuideDirection dir, int msecs )
return false;
if (state == GUIDE_CALIBRATING)
- QTimer::singleShot(msecs+100, this, SLOT(capture()));
+ pulseTimer.start(msecs+100);
return GuideDriver->doPulse(dir, msecs);
}
@@ -944,6 +951,23 @@ bool Guide::calibrate()
state = GUIDE_IDLE;
emit newStatus(state);
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
+
+ if (frameSettings.contains(targetChip))
+ {
+ targetChip->resetFrame();
+ int x,y,w,h;
+ targetChip->getFrame(&x, &y, &w, &h);
+ QVariantMap settings = frameSettings[targetChip];
+ settings["x"] = x;
+ settings["y"] = y;
+ settings["w"] = w;
+ settings["h"] = h;
+ frameSettings[targetChip] = settings;
+
+ subFramed = false;
+ }
+
saveSettings();
buildOperationStack(GUIDE_CALIBRATING);
@@ -1071,23 +1095,6 @@ void Guide::startAutoCalibrateGuide()
// A must for auto stuff
Options::setGuideAutoStarEnabled(true);
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- if (frameSettings.contains(targetChip))
- {
- targetChip->resetFrame();
- int x,y,w,h;
- targetChip->getFrame(&x, &y, &w, &h);
- QVariantMap settings = frameSettings[targetChip];
- settings["x"] = x;
- settings["y"] = y;
- settings["w"] = w;
- settings["h"] = h;
- frameSettings[targetChip] = settings;
-
- subFramed = false;
- }
-
calibrationComplete = false;
autoCalibrateGuide = true;
@@ -1869,7 +1876,7 @@ void Guide::buildOperationStack(GuideState operation)
bool Guide::executeOperationStack()
{
- if (operationStack.isEmpty() || state == GUIDE_ABORTED)
+ if (operationStack.isEmpty())
return false;
GuideState nextOperation = operationStack.pop();
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index e9492e1..98220be 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -450,6 +450,9 @@ private:
// Guide timer
QTime guideTimer;
+ // Pulse Timer
+ QTimer pulseTimer;
+
// Log
QStringList logText;