summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-29 19:24:39 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-29 19:24:39 (GMT)
commitcd598e8a0e1023c7c7ec62dc9c329c4dcd7b12cf (patch)
tree701ef30bd336348f7bf8e6db085720de9ed8361f
parent41aa2eb88d2a550ac83b8af970d3f1882d7e7b0c (diff)
Preliminary support to solving captured non-FITS images in Align module. Needs testing
-rw-r--r--kstars/ekos/align/align.cpp56
-rw-r--r--kstars/ekos/align/align.h4
-rw-r--r--kstars/indi/indiccd.cpp9
-rw-r--r--kstars/indi/indiccd.h2
4 files changed, 38 insertions, 33 deletions
diff --git a/kstars/ekos/align/align.cpp b/kstars/ekos/align/align.cpp
index 750d1db..4518dfe 100644
--- a/kstars/ekos/align/align.cpp
+++ b/kstars/ekos/align/align.cpp
@@ -692,33 +692,39 @@ void Align::newFITS(IBLOB *bp)
appendLogText(i18n("Image received."));
+ blobType = *(static_cast<ISD::CCD::BlobType*>(bp->aux1));
+ blobFileName = QString(static_cast<char*>(bp->aux2));
+
if (solverTypeGroup->checkedId() != SOLVER_REMOTE)
{
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
-
- if (alignDarkFrameCheck->isChecked())
+ if (blobType == ISD::CCD::BLOB_FITS)
{
- int x,y,w,h,binx=1,biny=1;
- targetChip->getFrame(&x,&y,&w,&h);
- targetChip->getBinning(&binx, &biny);
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
- FITSView *currentImage = targetChip->getImageView(FITS_ALIGN);
- FITSData *darkData = NULL;
+ if (alignDarkFrameCheck->isChecked())
+ {
+ int x,y,w,h,binx=1,biny=1;
+ targetChip->getFrame(&x,&y,&w,&h);
+ targetChip->getBinning(&binx, &biny);
- uint16_t offsetX = x / binx;
- uint16_t offsetY = y / biny;
+ FITSView *currentImage = targetChip->getImageView(FITS_ALIGN);
+ FITSData *darkData = NULL;
- darkData = DarkLibrary::Instance()->getDarkFrame(targetChip, exposureIN->value());
+ uint16_t offsetX = x / binx;
+ uint16_t offsetY = y / biny;
- connect(DarkLibrary::Instance(), SIGNAL(darkFrameCompleted(bool)), this, SLOT(setCaptureComplete()));
- connect(DarkLibrary::Instance(), SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
+ darkData = DarkLibrary::Instance()->getDarkFrame(targetChip, exposureIN->value());
- if (darkData)
- DarkLibrary::Instance()->subtract(darkData, currentImage, FITS_NONE, offsetX, offsetY);
- else
- DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
+ connect(DarkLibrary::Instance(), SIGNAL(darkFrameCompleted(bool)), this, SLOT(setCaptureComplete()));
+ connect(DarkLibrary::Instance(), SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
- return;
+ if (darkData)
+ DarkLibrary::Instance()->subtract(darkData, currentImage, FITS_NONE, offsetX, offsetY);
+ else
+ DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
+
+ return;
+ }
}
setCaptureComplete();
@@ -727,19 +733,9 @@ void Align::newFITS(IBLOB *bp)
void Align::setCaptureComplete()
{
- DarkLibrary::Instance()->disconnect(this);
-
- ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
- FITSView *currentImage = targetChip->getImageView(FITS_ALIGN);
- FITSData *currentData = currentImage->getImageData();
-
- QString filename = currentData->getFilename();
-
- // Save frame after subtraction
- if (alignDarkFrameCheck->isChecked())
- currentImage->getImageData()->saveFITS(filename);
+ DarkLibrary::Instance()->disconnect(this);
- startSolving(filename);
+ startSolving(blobFileName);
}
void Align::setGOTOMode(int mode)
diff --git a/kstars/ekos/align/align.h b/kstars/ekos/align/align.h
index f4b455f..8ec4e3c 100644
--- a/kstars/ekos/align/align.h
+++ b/kstars/ekos/align/align.h
@@ -455,6 +455,10 @@ private:
// Timer
QTimer alignTimer;
+
+ // BLOB Type
+ ISD::CCD::BlobType blobType;
+ QString blobFileName;
};
}
diff --git a/kstars/indi/indiccd.cpp b/kstars/indi/indiccd.cpp
index 9e62853..62642a4 100644
--- a/kstars/indi/indiccd.cpp
+++ b/kstars/indi/indiccd.cpp
@@ -1060,9 +1060,6 @@ void CCD::processText(ITextVectorProperty *tvp)
void CCD::processBLOB(IBLOB* bp)
{
-
- enum blobType { BLOB_IMAGE, BLOB_FITS, BLOB_RAW, BLOB_OTHER} BType;
-
BType = BLOB_OTHER;
QString format(bp->format);
@@ -1189,6 +1186,7 @@ void CCD::processBLOB(IBLOB* bp)
// store file name
strncpy(BLOBFilename, filename.toLatin1(), MAXINDIFILENAME);
+ bp->aux1 = &BType;
bp->aux2 = BLOBFilename;
if (targetChip->getCaptureMode() == FITS_NORMAL && targetChip->isBatchMode() == true)
@@ -1275,6 +1273,11 @@ void CCD::processBLOB(IBLOB* bp)
#endif
}
+ // store file name in
+ strncpy(BLOBFilename, filename.toLatin1(), MAXINDIFILENAME);
+ bp->aux1 = &BType;
+ bp->aux2 = BLOBFilename;
+
if (imageViewer.isNull())
imageViewer = new ImageViewer(getDeviceName(), KStars::Instance());
diff --git a/kstars/indi/indiccd.h b/kstars/indi/indiccd.h
index 1869fb3..4fc9ee6 100644
--- a/kstars/indi/indiccd.h
+++ b/kstars/indi/indiccd.h
@@ -136,6 +136,8 @@ public:
~CCD();
typedef enum { UPLOAD_CLIENT, UPLOAD_LOCAL, UPLOAD_BOTH } UploadMode;
+ enum BlobType { BLOB_IMAGE, BLOB_FITS, BLOB_RAW, BLOB_OTHER} BType;
+
void registerProperty(INDI::Property *prop);
void processSwitch(ISwitchVectorProperty *svp);
void processText(ITextVectorProperty* tvp);