Commit a241a91e authored by Jasem Mutlaq's avatar Jasem Mutlaq

Fixes in capture and focus module. Checking if FITS directory exists in batch mode.

parent bbd90279
......@@ -67,6 +67,7 @@ void SequenceJob::prepareCapture()
if (filterPos != -1 && activeFilter != NULL)
activeFilter->runCommand(INDI_SET_FILTER, &filterPos);
}
SequenceJob::CAPTUREResult SequenceJob::capture(bool isDark)
......@@ -275,6 +276,7 @@ void Capture::stopSequence()
if (activeJob && activeJob->getStatus() == SequenceJob::JOB_BUSY)
activeJob->abort();
currentCCD->disconnect(this);
imgProgress->reset();
imgProgress->setEnabled(false);
......@@ -944,6 +946,9 @@ void Capture::executeJob(SequenceJob *job)
useGuideHead = (activeJob->getActiveChip()->getType() == ISD::CCDChip::PRIMARY_CCD) ? false : true;
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double)));
captureImage();
}
......
......@@ -207,7 +207,8 @@ void Focus::stopFocus()
targetChip->setFrame(fx, fy, fw, fh);
FITSView *targetImage = targetChip->getImage(FITS_FOCUS);
targetImage->updateMode(FITS_FOCUS);
if (targetImage)
targetImage->updateMode(FITS_FOCUS);
resetButtons();
......@@ -242,8 +243,6 @@ void Focus::capture()
targetChip->capture(seqExpose);
qDebug() << "IN CAPTURE..." << endl;
if (inFocusLoop == false)
appendLogText(i18n("Capturing image..."));
......@@ -331,12 +330,9 @@ void Focus::newFITS(IBLOB *bp)
double currentHFR= image_data->getHFR(HFR_MAX);
qDebug() << "curent HFR is " << currentHFR << endl;
if (currentHFR == -1)
{
currentHFR = image_data->getHFR();
qDebug() << "and now hfr is " << currentHFR << endl;
}
HFRText = QString("%1").arg(currentHFR, 0,'g', 3);
......@@ -357,6 +353,9 @@ void Focus::newFITS(IBLOB *bp)
if (starSelected == false)
{
int binx, biny;
targetChip->getBinning(&binx, &biny);
if (kcfg_autoSelectStar->isChecked())
{
Edge *maxStar = image_data->getMaxHFRStar();
......@@ -366,11 +365,21 @@ void Focus::newFITS(IBLOB *bp)
return;
}
targetChip->getFrame(&fx, &fy, &fw, &fh);
int x=maxStar->x - maxStar->width * 2;
int y=maxStar->y - maxStar->width * 2;
int w=maxStar->width*4;
int h=maxStar->width*4;
targetChip->getFrame(&fx, &fy, &fw, &fh);
int w=maxStar->width*4*binx;
int h=maxStar->width*4*biny;
if (x<0)
x=0;
if (y<0)
y=0;
if (w>fw)
w=fw;
if (h>fh)
h=fh;
targetChip->setFrame(x, y, w, h);
......@@ -889,11 +898,14 @@ void Focus::focusStarSelected(int x, int y)
{
ISD::CCDChip *targetChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD);
int offset = kcfg_focusBoxSize->value();
int binx, biny;
targetChip->getBinning(&binx, &biny);
x -= offset*2 ;
y -= offset*2;
int w=offset*4;
int h=offset*4;
int w=offset*4*binx;
int h=offset*4*biny;
FITSView *targetImage = targetChip->getImage(FITS_FOCUS);
targetImage->updateMode(FITS_FOCUS);
......
......@@ -180,14 +180,14 @@ bool FITSView::loadFITS ( const QString &inFilename )
image_width = currentWidth;
image_height = currentHeight;
image_frame->setSize(currentWidth, currentHeight);
image_frame->setSize(image_width, image_height);
hasWCS = image_data->hasWCS();
delete (display_image);
display_image = NULL;
display_image = new QImage(currentWidth, currentHeight, QImage::Format_Indexed8);
display_image = new QImage(image_width, image_height, QImage::Format_Indexed8);
display_image->setNumColors(256);
for (int i=0; i < 256; i++)
......@@ -212,7 +212,7 @@ bool FITSView::loadFITS ( const QString &inFilename )
setAlignment(Qt::AlignCenter);
if (isVisible())
emit newStatus(QString("%1x%2").arg(currentWidth).arg(currentHeight), FITS_RESOLUTION);
emit newStatus(QString("%1x%2").arg(image_width).arg(image_height), FITS_RESOLUTION);
return true;
}
......
......@@ -699,6 +699,12 @@ void CCD::processBLOB(IBLOB* bp)
if (currentDir.endsWith('/'))
currentDir.truncate(sizeof(currentDir)-1);
if (QDir(currentDir).exists() == false)
{
KMessageBox::error(0, i18n("FITS directory %1 does not exist. Please update the directory in the options.", currentDir));
return;
}
QString filename(currentDir + '/');
// Create file name for FITS to be shown in FITS Viewer
......
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