Commit 4e245ad0 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Retain frame value when receving updated CCD_INFO property unless they are out of bounds

parent 40317095
......@@ -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;
}
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment