summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-25 17:29:23 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-25 17:29:23 (GMT)
commit4e245ad02ebb2887dfc6f96a13684cef60e4b04a (patch)
tree4b197dd70647a27fe1e9ffd12c0df0dbc929ed0a
parent4031709511427971711f2fe9a8cbf748241ea25f (diff)
Retain frame value when receving updated CCD_INFO property unless they are out of bounds
-rw-r--r--kstars/ekos/capture/capture.cpp38
-rw-r--r--kstars/ekos/capture/capture.h5
2 files changed, 37 insertions, 6 deletions
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index f85cb6b..ff0c877 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -594,7 +594,7 @@ void Capture::checkCCD(int ccdNum)
}
}
-void Capture::updateFrameProperties(bool reset)
+void Capture::updateFrameProperties(int reset)
{
int x,y,w,h;
int binx=1,biny=1;
@@ -698,7 +698,7 @@ void Capture::updateFrameProperties(bool reset)
else
return;
- if (reset || frameSettings.contains(targetChip) == false)
+ if (reset == 1 || frameSettings.contains(targetChip) == false)
{
QVariantMap settings;
@@ -711,6 +711,29 @@ void Capture::updateFrameProperties(bool reset)
frameSettings[targetChip] = settings;
}
+ else if (reset == 2 && frameSettings.contains(targetChip))
+ {
+ QVariantMap settings = frameSettings[targetChip];
+ int x,y,w,h;
+
+ x = settings["x"].toInt();
+ y = settings["y"].toInt();
+ w = settings["w"].toInt();
+ h = settings["h"].toInt();
+
+ // Bound them
+ x = qBound(frameXIN->minimum(), x, frameXIN->maximum()-1);
+ y = qBound(frameYIN->minimum(), y, frameYIN->maximum()-1);
+ w = qBound(frameWIN->minimum(), w, frameWIN->maximum());
+ h = qBound(frameHIN->minimum(), h, frameHIN->maximum());
+
+ settings["x"] = x;
+ settings["y"] = y;
+ settings["w"] = w;
+ settings["h"] = h;
+
+ frameSettings[targetChip] = settings;
+ }
if (frameSettings.contains(targetChip))
{
@@ -749,15 +772,20 @@ void Capture::updateFrameProperties(bool reset)
void Capture::processCCDNumber(INumberVectorProperty *nvp)
{
- if (currentCCD && ( (!strcmp(nvp->name, "CCD_FRAME") && useGuideHead == false) || (!strcmp(nvp->name, "GUIDER_FRAME") && useGuideHead)))
+ if (currentCCD == NULL)
+ return;
+
+ if ((!strcmp(nvp->name, "CCD_FRAME") && useGuideHead == false) || (!strcmp(nvp->name, "GUIDER_FRAME") && useGuideHead))
updateFrameProperties();
+ else if ((!strcmp(nvp->name, "CCD_INFO") && useGuideHead == false) || (!strcmp(nvp->name, "GUIDER_INFO") && useGuideHead))
+ updateFrameProperties(2);
}
void Capture::resetFrame()
{
targetChip = useGuideHead ? currentCCD->getChip(ISD::CCDChip::GUIDE_CCD) : currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD);
targetChip->resetFrame();
- updateFrameProperties(true);
+ updateFrameProperties(1);
}
void Capture::syncFrameType(ISD::GDInterface *ccd)
@@ -1145,7 +1173,7 @@ void Capture::captureOne()
//if (currentCCD->getUploadMode() == ISD::CCD::UPLOAD_LOCAL)
if (uploadModeCombo->currentIndex() != 0)
{
- appendLogText(i18n("Cannot take preview image while CCD upload mode is set to local. Please change upload mode to client and try again."));
+ appendLogText(i18n("Cannot take preview image while CCD upload mode is set to local or both. Please change upload mode to client and try again."));
return;
}
diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h
index 8fad82a..736beb6 100644
--- a/kstars/ekos/capture/capture.h
+++ b/kstars/ekos/capture/capture.h
@@ -454,7 +454,10 @@ private:
void setBusy(bool enable);
bool resumeSequence();
bool startNextExposure();
- void updateFrameProperties(bool reset=false);
+ // reset = 0 --> Do not reset
+ // reset = 1 --> Full reset
+ // reset = 2 --> Only update limits if needed
+ void updateFrameProperties(int reset=0);
void prepareJob(SequenceJob *job);
void syncGUIToJob(SequenceJob *job);
bool processJobInfo(XMLEle *root);