summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-31 12:12:41 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-31 12:12:41 (GMT)
commit4b23f1ed87c5bee786e1324eb5036e272b0fc933 (patch)
tree32bf99cef1d957b751e23c9875eb51af0cda64c8
parent3518013b052ea57ffd5a96b5851aa8cd3f141cf9 (diff)
Save the frame settings for the current session for all the CCDs. Settings are saved when an image is captured. Needs testing
-rw-r--r--kstars/ekos/capture.cpp88
-rw-r--r--kstars/ekos/capture.h4
2 files changed, 68 insertions, 24 deletions
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index 94b9820..540fd81 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -369,7 +369,6 @@ void Capture::abort()
}
secondsLabel->clear();
- //currentCCD->disconnect(this);
disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
disconnect(currentCCD, SIGNAL(newImage(QImage*,ISD::CCDChip*)), this, SLOT(sendNewImage(QImage*,ISD::CCDChip*)));
disconnect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double, IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)));
@@ -478,6 +477,7 @@ void Capture::checkCCD(int ccdNum)
temperatureIN->clear();
setTemperatureB->setEnabled(false);
}
+
updateFrameProperties();
QStringList frameTypes = targetChip->getFrameTypes();
@@ -515,9 +515,10 @@ void Capture::checkCCD(int ccdNum)
}
}
-void Capture::updateFrameProperties()
+void Capture::updateFrameProperties(bool reload)
{
int x,y,w,h;
+ int binx=1,biny=1;
double min,max,step;
int xstep=0, ystep=0;
@@ -539,23 +540,7 @@ void Capture::updateFrameProperties()
exposureIN->setMinimum(min);
exposureIN->setMaximum(max);
exposureIN->setSingleStep(step);
- }
-
- if (targetChip->canBin())
- {
- int binx=1,biny=1;
- targetChip->getMaxBin(&binx, &biny);
- binXIN->setMaximum(binx);
- binYIN->setMaximum(biny);
- targetChip->getBinning(&binx, &biny);
- binXIN->setValue(binx);
- binYIN->setValue(biny);
- }
- else
- {
- binXIN->setValue(1);
- binYIN->setValue(1);
- }
+ }
if (currentCCD->getMinMaxStep(frameProp, "WIDTH", &min, &max, &step))
{
@@ -613,8 +598,53 @@ void Capture::updateFrameProperties()
}
}
- if (targetChip->getFrame(&x,&y,&w,&h))
+ if ( reload || frameSettings.contains(targetChip) == false)
+ {
+ QVariantMap settings;
+ bool haveFrame=false, haveBinning=false;
+
+ if ( (haveFrame = targetChip->getFrame(&x,&y,&w,&h)) )
+ {
+ settings["x"] = x;
+ settings["y"] = y;
+ settings["w"] = w;
+ settings["h"] = h;
+ }
+
+ if ( (haveBinning = targetChip->getBinning(&binx, &biny)) )
+ {
+ settings["binx"] = binx;
+ settings["biny"] = biny;
+ }
+
+ if (haveFrame && haveBinning)
+ frameSettings[targetChip] = settings;
+ }
+
+ if (frameSettings.contains(targetChip))
{
+ QVariantMap settings = frameSettings[targetChip];
+
+ if (targetChip->canBin())
+ {
+ targetChip->getMaxBin(&binx, &biny);
+ binXIN->setMaximum(binx);
+ binYIN->setMaximum(biny);
+
+ binXIN->setValue(settings["binx"].toInt());
+ binYIN->setValue(settings["biny"].toInt());
+ }
+ else
+ {
+ binXIN->setValue(1);
+ binYIN->setValue(1);
+ }
+
+ x = settings["x"].toInt();
+ y = settings["y"].toInt();
+ w = settings["w"].toInt();
+ h = settings["h"].toInt();
+
if (x >= 0)
frameXIN->setValue(x);
if (y >= 0)
@@ -624,20 +654,19 @@ void Capture::updateFrameProperties()
if (h > 0)
frameHIN->setValue(h);
}
-
}
void Capture::processCCDNumber(INumberVectorProperty *nvp)
{
if (currentCCD && ( (!strcmp(nvp->name, "CCD_FRAME") && useGuideHead == false) || (!strcmp(nvp->name, "GUIDER_FRAME") && useGuideHead)))
- updateFrameProperties();
+ updateFrameProperties();
}
void Capture::resetFrame()
{
targetChip = useGuideHead ? currentCCD->getChip(ISD::CCDChip::GUIDE_CCD) : currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD);
targetChip->resetFrame();
- updateFrameProperties();
+ updateFrameProperties(true);
}
void Capture::syncFrameType(ISD::GDInterface *ccd)
@@ -1048,6 +1077,19 @@ void Capture::captureImage()
if (activeJob->isPreview() == false)
emit newStatus(Ekos::CAPTURE_CAPTURING);
+ if (frameSettings.contains(activeJob->getActiveChip()))
+ {
+ QVariantMap settings;
+ settings["x"] = activeJob->getSubX();
+ settings["y"] = activeJob->getSubY();
+ settings["w"] = activeJob->getSubW();
+ settings["h"] = activeJob->getSubH();
+ settings["binx"] = activeJob->getXBin();
+ settings["biny"] = activeJob->getYBin();
+
+ frameSettings[activeJob->getActiveChip()] = settings;
+ }
+
rc = activeJob->capture(isDark);
switch (rc)
diff --git a/kstars/ekos/capture.h b/kstars/ekos/capture.h
index 8c8214e..c0bed20 100644
--- a/kstars/ekos/capture.h
+++ b/kstars/ekos/capture.h
@@ -445,7 +445,7 @@ private:
void setBusy(bool enable);
bool resumeSequence();
void startNextExposure();
- void updateFrameProperties();
+ void updateFrameProperties(bool reload=false);
void prepareJob(SequenceJob *job);
void syncGUIToJob(SequenceJob *job);
bool processJobInfo(XMLEle *root);
@@ -549,6 +549,8 @@ private:
// Misc
bool ignoreJobProgress;
+ // CCD Chip frame settings
+ QMap<ISD::CCDChip *, QVariantMap> frameSettings;
// Temporary Only
QProcess postCaptureScript;