Commit 63db5a46 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Do not add new tabs on capture failure

parent 3c9b48e9
......@@ -1258,19 +1258,26 @@ void CCD::processBLOB(IBLOB* bp)
}
int tabRC = -1;
switch (targetChip->getCaptureMode())
{
case FITS_NORMAL:
if (normalTabID == -1 || Options::singlePreviewFITS() == false)
normalTabID = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
tabRC = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
else if (fv->updateFITS(&fileURL, normalTabID, captureFilter) == false)
{
fv->removeFITS(normalTabID);
normalTabID = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
tabRC = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
}
else
tabRC = normalTabID;
if (normalTabID >= 0)
if (tabRC >= 0)
{
normalTabID = tabRC;
targetChip->setImage(fv->getView(normalTabID), FITS_NORMAL);
}
else
// If opening file fails, we treat it the same as exposure failure and recapture again if possible
emit newExposureValue(targetChip, 0, IPS_ALERT);
......@@ -1278,47 +1285,61 @@ void CCD::processBLOB(IBLOB* bp)
case FITS_FOCUS:
if (focusTabID == -1)
focusTabID = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
else if (fv->updateFITS(&fileURL, focusTabID, captureFilter) == false)
{
fv->removeFITS(focusTabID);
focusTabID = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
}
else
tabRC = focusTabID;
if (focusTabID >= 0)
if (tabRC >= 0)
{
focusTabID = tabRC;
targetChip->setImage(fv->getView(focusTabID), FITS_FOCUS);
}
else
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;
case FITS_GUIDE:
if (guideTabID == -1)
guideTabID = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
else if (fv->updateFITS(&fileURL, guideTabID, captureFilter) == false)
{
fv->removeFITS(guideTabID);
guideTabID = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
}
else
tabRC = guideTabID;
if (guideTabID >= 0)
{
guideTabID = tabRC;
targetChip->setImage(fv->getView(guideTabID), FITS_GUIDE);
}
else
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;
case FITS_CALIBRATE:
if (calibrationTabID == -1)
calibrationTabID = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
else if (fv->updateFITS(&fileURL, calibrationTabID, captureFilter) == false)
{
fv->removeFITS(calibrationTabID);
calibrationTabID = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
tabRC = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
}
else
tabRC = calibrationTabID;
if (calibrationTabID >= 0)
if (tabRC >= 0)
{
calibrationTabID = tabRC;
targetChip->setImage(fv->getView(calibrationTabID), FITS_CALIBRATE);
}
else
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;
......
Markdown is supported
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