summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-06 18:45:15 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-06 18:45:15 (GMT)
commit94999566b67737e9c625a9cde709c0da6ce5bddb (patch)
tree9625f72febcbad8a2780edb71444c5adf51d8eb6
parent4e290affbce9378a055180cd9b062ab63a2361dd (diff)
More progress on dark frame library. Now it works across capture, guide, and focus modules
-rw-r--r--kstars/ekos/capture.cpp108
-rw-r--r--kstars/ekos/focus.cpp10
-rw-r--r--kstars/ekos/focus.ui2
-rw-r--r--kstars/ekos/guide.cpp41
-rw-r--r--kstars/ekos/guide.h11
-rw-r--r--kstars/ekos/guide.ui42
-rw-r--r--kstars/ekos/guide/gmath.cpp42
-rw-r--r--kstars/ekos/guide/gmath.h7
-rw-r--r--kstars/ekos/guide/guider.cpp60
-rw-r--r--kstars/ekos/guide/rcalibration.cpp78
-rw-r--r--kstars/ekos/guide/rcalibration.h6
-rw-r--r--kstars/ekos/guide/rcalibration.ui36
-rw-r--r--kstars/ekos/sequencejob.cpp46
-rw-r--r--kstars/ekos/sequencejob.h2
-rw-r--r--kstars/kstars.kcfg4
-rw-r--r--kstars/org.kde.kstars.Ekos.Guide.xml4
16 files changed, 269 insertions, 230 deletions
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index df6e47e..c80706b 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -1058,7 +1058,7 @@ void Capture::captureImage()
}
//if (useGuideHead == false && darkSubCheck->isChecked() && calibrationState == CALIBRATE_NONE)
- //isDark = true;
+ //isDark = true;
if (filterSlot != NULL)
{
@@ -1073,74 +1073,68 @@ void Capture::captureImage()
activeJob->setCurrentTemperature(temperature);
}
- connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)), Qt::UniqueConnection);
- connect(currentCCD, SIGNAL(newImage(QImage*, ISD::CCDChip*)), this, SLOT(sendNewImage(QImage*, ISD::CCDChip*)), Qt::UniqueConnection);
+ connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)), Qt::UniqueConnection);
+ connect(currentCCD, SIGNAL(newImage(QImage*, ISD::CCDChip*)), this, SLOT(sendNewImage(QImage*, ISD::CCDChip*)), Qt::UniqueConnection);
- if (activeJob->getFrameType() == FRAME_FLAT)
- {
- // If we have to calibrate ADU levels, first capture must be preview and not in batch mode
- if (activeJob->isPreview() == false && activeJob->getFlatFieldDuration() == DURATION_ADU && calibrationStage == CAL_PRECAPTURE_COMPLETE)
- {
+ if (activeJob->getFrameType() == FRAME_FLAT)
+ {
+ // If we have to calibrate ADU levels, first capture must be preview and not in batch mode
+ if (activeJob->isPreview() == false && activeJob->getFlatFieldDuration() == DURATION_ADU && calibrationStage == CAL_PRECAPTURE_COMPLETE)
+ {
calibrationStage = CAL_CALIBRATION;
activeJob->setPreview(true);
- }
- }
+ }
+ }
- if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL)
+ if (currentCCD->getUploadMode() != ISD::CCD::UPLOAD_LOCAL)
checkSeqBoundary(activeJob->getFITSDir());
- if (activeJob->isPreview() == false)
+ if (activeJob->isPreview() == false)
emit newStatus(Ekos::CAPTURE_CAPTURING);
- if (frameSettings.contains(activeJob->getActiveChip()))
- {
- QVariantMap settings;
- settings["x"] = activeJob->getSubX();
- settings["y"] = activeJob->getSubY();
- settings["w"] = activeJob->getSubW();
- settings["h"] = activeJob->getSubH();
- settings["binx"] = activeJob->getXBin();
- settings["biny"] = activeJob->getYBin();
-
- frameSettings[activeJob->getActiveChip()] = settings;
- }
-
- rc = activeJob->capture();
-
- switch (rc)
- {
- case SequenceJob::CAPTURE_OK:
- connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)), Qt::UniqueConnection);
- /*if (isDark)
- {
- calibrationState = CALIBRATE_START;
- appendLogText(i18n("Capturing dark frame..."));
- }
- else*/
- appendLogText(i18n("Capturing image..."));
- break;
-
- case SequenceJob::CAPTURE_FRAME_ERROR:
- appendLogText(i18n("Failed to set sub frame."));
- abort();
- break;
+ if (frameSettings.contains(activeJob->getActiveChip()))
+ {
+ QVariantMap settings;
+ settings["x"] = activeJob->getSubX();
+ settings["y"] = activeJob->getSubY();
+ settings["w"] = activeJob->getSubW();
+ settings["h"] = activeJob->getSubH();
+ settings["binx"] = activeJob->getXBin();
+ settings["biny"] = activeJob->getYBin();
- case SequenceJob::CAPTURE_BIN_ERROR:
- appendLogText(i18n("Failed to set binning."));
- abort();
- break;
+ frameSettings[activeJob->getActiveChip()] = settings;
+ }
- case SequenceJob::CAPTURE_FILTER_BUSY:
- // Try again in 1 second if filter is busy
- QTimer::singleShot(1000, this, SLOT(captureImage()));
- break;
+ rc = activeJob->capture(darkSubCheck->isChecked() ? true : false);
- case SequenceJob::CAPTURE_FOCUS_ERROR:
- appendLogText(i18n("Cannot capture while module is busy."));
- abort();
- break;
+ switch (rc)
+ {
+ case SequenceJob::CAPTURE_OK:
+ connect(currentCCD, SIGNAL(newExposureValue(ISD::CCDChip*,double,IPState)), this, SLOT(updateCaptureProgress(ISD::CCDChip*,double,IPState)), Qt::UniqueConnection);
+ appendLogText(i18n("Capturing image..."));
+ break;
+
+ case SequenceJob::CAPTURE_FRAME_ERROR:
+ appendLogText(i18n("Failed to set sub frame."));
+ abort();
+ break;
- }
+ case SequenceJob::CAPTURE_BIN_ERROR:
+ appendLogText(i18n("Failed to set binning."));
+ abort();
+ break;
+
+ case SequenceJob::CAPTURE_FILTER_BUSY:
+ // Try again in 1 second if filter is busy
+ QTimer::singleShot(1000, this, SLOT(captureImage()));
+ break;
+
+ case SequenceJob::CAPTURE_FOCUS_ERROR:
+ appendLogText(i18n("Cannot capture while module is busy."));
+ abort();
+ break;
+
+ }
}
void Capture::resumeCapture()
diff --git a/kstars/ekos/focus.cpp b/kstars/ekos/focus.cpp
index 99d61ed..99e1e4f 100644
--- a/kstars/ekos/focus.cpp
+++ b/kstars/ekos/focus.cpp
@@ -212,7 +212,7 @@ Focus::Focus()
kcfg_subFrame->setChecked(Options::focusSubFrame());
suspendGuideCheck->setChecked(Options::suspendGuiding());
lockFilterCheck->setChecked(Options::lockFocusFilter());
- focusDarkFrameCheck->setChecked(Options::focusDarkFrame());
+ darkFrameCheck->setChecked(Options::useFocusDarkFrame());
thresholdSpin->setValue(Options::focusThreshold());
focusFramesSpin->setValue(Options::focusFrames());
@@ -709,7 +709,7 @@ void Focus::start()
Options::setAutoSelectStar(kcfg_autoSelectStar->isChecked());
Options::setSuspendGuiding(suspendGuideCheck->isChecked());
Options::setLockFocusFilter(lockFilterCheck->isChecked());
- Options::setFocusDarkFrame(focusDarkFrameCheck->isChecked());
+ Options::setUseFocusDarkFrame(darkFrameCheck->isChecked());
if (Options::focusLogging())
qDebug() << "Focus: Starting focus with box size: " << focusBoxSize->value() << " Step Size: " << stepIN->value() << " Threshold: " << thresholdSpin->value() << " Tolerance: " << toleranceIN->value()
@@ -838,7 +838,7 @@ void Focus::capture()
targetChip->setCaptureMode(FITS_FOCUS);
// Always disable filtering if using a dark frame and then re-apply after subtraction. TODO: Implement this in capture and guide and align
- if (focusDarkFrameCheck->isChecked())
+ if (darkFrameCheck->isChecked())
targetChip->setCaptureFilter(FITS_NONE);
else
targetChip->setCaptureFilter(defaultScale);
@@ -965,7 +965,7 @@ void Focus::newFITS(IBLOB *bp)
ISD::CCDChip *targetChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD);
disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
- if (focusDarkFrameCheck->isChecked())
+ if (darkFrameCheck->isChecked())
{
FITSView *currentImage = targetChip->getImage(FITS_FOCUS);
FITSData *darkData = NULL;
@@ -1040,8 +1040,6 @@ void Focus::setCaptureComplete()
FITSData *image_data = targetChip->getImageData();
-
-
starPixmap = targetImage->getTrackingBoxPixmap();
emit newStarPixmap(starPixmap);
diff --git a/kstars/ekos/focus.ui b/kstars/ekos/focus.ui
index 1c9ce17..ab5bc10 100644
--- a/kstars/ekos/focus.ui
+++ b/kstars/ekos/focus.ui
@@ -551,7 +551,7 @@ Otherwise, the autofocus process will utilize whatever filter currently set by t
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
- <widget class="QCheckBox" name="focusDarkFrameCheck">
+ <widget class="QCheckBox" name="darkFrameCheck">
<property name="toolTip">
<string/>
</property>
diff --git a/kstars/ekos/guide.cpp b/kstars/ekos/guide.cpp
index dc47574..499539d 100644
--- a/kstars/ekos/guide.cpp
+++ b/kstars/ekos/guide.cpp
@@ -47,8 +47,7 @@ Guide::Guide() : QWidget()
currentCCD = NULL;
currentTelescope = NULL;
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
- useGuideHead = false;
- useDarkFrame = false;
+ useGuideHead = false;
rapidGuideReticleSet = false;
isSuspended = false;
AODriver= NULL;
@@ -101,6 +100,9 @@ Guide::Guide() : QWidget()
foreach(QString filter, FITSViewer::filterTypes)
filterCombo->addItem(filter);
+ darkFrameCheck->setChecked(Options::useGuideDarkFrame());
+ connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
+
phd2 = new PHD2();
connect(phd2, SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
@@ -440,7 +442,11 @@ bool Guide::capture()
targetChip->setCaptureMode(FITS_GUIDE);
targetChip->setFrameType(FRAME_LIGHT);
- targetChip->setCaptureFilter((FITSScale) filterCombo->currentIndex());
+
+ if (Options::useGuideDarkFrame())
+ targetChip->setCaptureFilter(FITS_NONE);
+ else
+ targetChip->setCaptureFilter((FITSScale) filterCombo->currentIndex());
if (guider->isGuiding())
{
@@ -469,11 +475,8 @@ void Guide::newFITS(IBLOB *bp)
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
// Do we need to take a dark frame?
- if (useDarkFrame)
- {
- if (calibration->useAutoStar() == false)
- KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
-
+ if (Options::useGuideDarkFrame())
+ {
int x,y,w,h;
int binx,biny;
@@ -493,8 +496,12 @@ void Guide::newFITS(IBLOB *bp)
if (darkData)
DarkLibrary::Instance()->subtract(darkData, currentImage, targetChip->getCaptureFilter(), offsetX, offsetY);
else
- DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
+ {
+ if (calibration->useAutoStar() == false)
+ KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
+ DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
+ }
return;
}
@@ -918,11 +925,6 @@ void Guide::setCalibrationAutoSquareSize(bool enable)
calibration->setCalibrationAutoSquareSize(enable);
}
-void Guide::setCalibrationDarkFrame(bool enable)
-{
- calibration->setCalibrationDarkFrame(enable);
-}
-
void Guide::setCalibrationParams(int boxSize, int pulseDuration)
{
calibration->setCalibrationParams(boxSize, pulseDuration);
@@ -938,7 +940,7 @@ void Guide::setGuideAlgorithm(const QString & algorithm)
guider->setGuideOptions(guider->getBoxSize(), algorithm, guider->useSubFrame(), guider->useRapidGuide());
}
-void Guide::setGuideSubFrame(bool enable)
+void Guide::setSubFrameEnabled(bool enable)
{
guider->setGuideOptions(guider->getBoxSize(), guider->getAlgorithm(), enable , guider->useRapidGuide());
}
@@ -1059,6 +1061,9 @@ void Guide::updateCCDBin(int index)
ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
targetChip->setBinning(index+1, index+1);
+
+ if (pmath)
+ pmath->setBinning(index+1, index+1);
}
void Guide::processCCDNumber(INumberVectorProperty *nvp)
@@ -1085,9 +1090,9 @@ void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPStat
}
}
-void Guide::setUseDarkFrame(bool enable)
-{
- useDarkFrame = enable;
+void Guide::setDarkFrameEnabled(bool enable)
+{
+ Options::setUseGuideDarkFrame(enable);
if (enable && calibration && calibration->useAutoStar())
appendLogText(i18n("Warning: In auto mode, you will not be asked to cover cameras unequipped with shutters in order to capture a dark frame. The dark frame capture will proceed without warning."
diff --git a/kstars/ekos/guide.h b/kstars/ekos/guide.h
index d957016..baa36a2 100644
--- a/kstars/ekos/guide.h
+++ b/kstars/ekos/guide.h
@@ -136,7 +136,7 @@ public:
* Set calibration dark frame option. The options must be set before starting the calibration operation. If no options are set, the options loaded from the user configuration are used.
* @param enable if true, a dark frame will be captured to subtract from the light frame.
*/
- Q_SCRIPTABLE Q_NOREPLY void setCalibrationDarkFrame(bool enable);
+ Q_SCRIPTABLE Q_NOREPLY void setDarkFrameEnabled(bool enable);
/** DBUS interface function.
* Set calibration parameters.
@@ -161,7 +161,7 @@ public:
* Set guiding options. The options must be set before starting the guiding operation. If no options are set, the options loaded from the user configuration are used.
* @param enable if true, it will select a subframe around the guide star depending on the boxSize size.
*/
- Q_SCRIPTABLE Q_NOREPLY void setGuideSubFrame(bool enable);
+ Q_SCRIPTABLE Q_NOREPLY void setSubFrameEnabled(bool enable);
/** DBUS interface function.
* Set rapid guiding option. The options must be set before starting the guiding operation. If no options are set, the options loaded from the user configuration are used.
@@ -247,8 +247,7 @@ public slots:
void checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState state);
void newFITS(IBLOB*);
void newST4(int index);
- void processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit);
- void setUseDarkFrame(bool enable);
+ void processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit);
void updateGuideDriver(double delta_ra, double delta_dec);
// Auto Calibration Guiding (Cablirate first then start guiding immediately)
@@ -317,9 +316,7 @@ private:
bool useGuideHead;
bool isSuspended;
- bool phd2Connected;
-
- bool useDarkFrame;
+ bool phd2Connected;
QStringList logText;
diff --git a/kstars/ekos/guide.ui b/kstars/ekos/guide.ui
index 839f58d..df9c8ba 100644
--- a/kstars/ekos/guide.ui
+++ b/kstars/ekos/guide.ui
@@ -37,6 +37,13 @@
</spacer>
</item>
<item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Via:</string>
@@ -60,6 +67,13 @@
</spacer>
</item>
<item>
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Exposure:</string>
@@ -90,6 +104,13 @@
</spacer>
</item>
<item>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Binning:</string>
@@ -113,6 +134,13 @@
</spacer>
</item>
<item>
+ <widget class="Line" name="line_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="label_8">
<property name="toolTip">
<string>Apply filter to image after capture to enhance it</string>
@@ -132,6 +160,20 @@
</widget>
</item>
<item>
+ <widget class="Line" name="line_5">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="darkFrameCheck">
+ <property name="text">
+ <string>Dark Frame</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/kstars/ekos/guide/gmath.cpp b/kstars/ekos/guide/gmath.cpp
index fffb5cd..6af694e 100644
--- a/kstars/ekos/guide/gmath.cpp
+++ b/kstars/ekos/guide/gmath.cpp
@@ -62,6 +62,8 @@ cgmath::cgmath() : QObject()
useRapidGuide = false;
dec_swap = false;
+ subBinX = subBinY = lastBinX = lastBinY = 1;
+
// square variables
square_idx = DEFAULT_SQR;
square_alg_idx = SMART_THRESHOLD;
@@ -347,21 +349,24 @@ void cgmath::move_square( double newx, double newy )
square_pos.y = newy;
// check frame ranges
- if( square_pos.x < 0 )
- square_pos.x = 0;
- if( square_pos.y < 0 )
- square_pos.y = 0;
- if( square_pos.x+(double)square_size > (double)video_width )
- square_pos.x = (double)(video_width - square_size);
- if( square_pos.y+(double)square_size > (double)video_height )
- square_pos.y = (double)(video_height - square_size);
+ if (lastBinX == subBinX)
+ {
+ if( square_pos.x < 0 )
+ square_pos.x = 0;
+ if( square_pos.y < 0 )
+ square_pos.y = 0;
+ if( square_pos.x+(double)square_size > (double)video_width )
+ square_pos.x = (double)(video_width - square_size);
+ if( square_pos.y+(double)square_size > (double)video_height )
+ square_pos.y = (double)(video_height - square_size);
+ }
// FITS Image takes center coords
if (guide_frame)
{
guide_frame->setTrackingBoxEnabled(true);
//guide_frame->setTrackingBoxCenter(QPointF(square_pos.x+square_size/2, square_pos.y+square_size/2));
- guide_frame->setTrackingBox(QRect(square_pos.x, square_pos.y, square_size, square_size));
+ guide_frame->setTrackingBox(QRect(square_pos.x, square_pos.y, square_size/subBinX, square_size/subBinY));
}
}
@@ -382,10 +387,10 @@ void cgmath::resize_square( int size_idx )
// check position
if (guide_frame)
- {
+ {
guide_frame->setTrackingBoxEnabled(true);
//guide_frame->setTrackingBoxSize(QSize(square_size,square_size));
- guide_frame->setTrackingBox(QRect(square_pos.x, square_pos.y, square_size, square_size));
+ guide_frame->setTrackingBox(QRect(square_pos.x/subBinX, square_pos.y/subBinY, square_size/subBinX, square_size/subBinY));
}
}
@@ -984,7 +989,7 @@ void cgmath::do_processing( void )
// move square overlay
- move_square( round(star_pos.x) - (double)square_size/2, round(star_pos.y) - (double)square_size/2 );
+ move_square( round(star_pos.x) - (double)square_size/(2*subBinX), round(star_pos.y) - (double)square_size/(2*subBinY) );
//move_square( ceil(star_pos.x) - (double)square_size/2, ceil(star_pos.y) - (double)square_size/2 );
if( preview_mode )
@@ -1120,6 +1125,15 @@ const char *cgmath::get_direction_string(GuideDirection dir)
}
+void cgmath::setBinning(int binx, int biny)
+{
+ lastBinX = subBinX;
+ lastBinY = subBinY;
+
+ subBinX = binx;
+ subBinY = biny;
+}
+
//---------------------------------------------------------------------------------------
cproc_in_params::cproc_in_params()
{
@@ -1162,7 +1176,3 @@ void cproc_out_params::reset( void )
sigma[k] = 0;
}
}
-
-
-
-
diff --git a/kstars/ekos/guide/gmath.h b/kstars/ekos/guide/gmath.h
index a9fdd64..53f5ae1 100644
--- a/kstars/ekos/guide/gmath.h
+++ b/kstars/ekos/guide/gmath.h
@@ -156,9 +156,15 @@ public:
ovr_params_t *prepare_overlays( void );
void move_square( double newx, double newy );
void resize_square( int size_idx );
+ Vector get_square_pos() { return square_pos; }
void setRapidGuide(bool enable);
void setRapidStarData(double dx, double dy);
+ void setBinning(int binx, int biny);
+ int getBinX() { return subBinX; }
+ int getBinY() { return subBinY; }
+ int getLastBinX() { return lastBinX; }
+ int getLastBinY() { return lastBinY; }
// proc
void start( void );
@@ -195,6 +201,7 @@ private:
Vector square_pos; // integer values in double vars.
int square_idx; // index in size list
int square_alg_idx; // index of threshold algorithm
+ int subBinX,subBinY, lastBinX, lastBinY;
// sky coord. system vars.
Vector star_pos; // position of star in reticle coord. system
diff --git a/kstars/ekos/guide/guider.cpp b/kstars/ekos/guide/guider.cpp
index 8eb5f94..6715030 100644
--- a/kstars/ekos/guide/guider.cpp
+++ b/kstars/ekos/guide/guider.cpp
@@ -458,7 +458,7 @@ bool rguider::stop()
}
if (guideFrame)
- connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int,int)));
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int,int)), Qt::UniqueConnection);
ui.pushButton_StartStop->setText( i18n("Start Autoguide") );
pmain_wnd->appendLogText(i18n("Autoguiding stopped."));
pmath->stop();
@@ -520,16 +520,22 @@ void rguider::onStartStopButtonClick()
void rguider::capture()
{
+ int binX=1, binY=1, lastBinX=1,lastBinY=1;
+
+ int square_size = pmath->get_square_size();
+ binX = pmath->getBinX();
+ binY = pmath->getBinY();
+ lastBinX = pmath->getLastBinX();
+ lastBinY = pmath->getLastBinY();
+
if (ui.subFrameCheck->isChecked() && m_isSubFramed == false)
{
- int x,y,w,h, square_size, binx, biny;
- targetChip->getBinning(&binx, &biny);
- pmath->get_reticle_params(&ret_x, &ret_y, &ret_angle);
- square_size = pmath->get_square_size();
- x = (ret_x - square_size)*binx;
- y = (ret_y - square_size)*biny;
- w=square_size*2*binx;
- h=square_size*2*biny;
+ int x,y,w,h;
+ pmath->get_reticle_params(&ret_x, &ret_y, &ret_angle);
+ x = (ret_x - square_size)*binX;
+ y = (ret_y - square_size)*binY;
+ w=square_size*2*binX;
+ h=square_size*2*binY;
int minX, maxX, minY, maxY, minW, maxW, minH, maxH;
targetChip->getFrameMinMax(&minX, &maxX, &minY, &maxY, &minW, &maxW, &minH, &maxH);
@@ -545,17 +551,34 @@ void rguider::capture()
if ((h+y)>maxH)
h=maxH-y;
- pmath->set_video_params(w/binx, h/biny);
+ pmath->set_video_params(w/binX, h/binY);
targetChip->setFrame(x, y, w, h);
- trackingStarSelected(w/binx/2, h/biny/2);
+ trackingStarSelected(w/(binX*2), h/(binY*2));
}
else if (ui.subFrameCheck->isChecked() == false/* && is_subframed == true*/)
{
- m_isSubFramed = false;
- //targetChip->setFrame(fx, fy, fw, fh);
+ m_isSubFramed = false;
targetChip->resetFrame();
+
+ Vector square_pos = pmath->get_square_pos();
+
+ if (square_pos.x == 0 && square_pos.y == 0)
+ {
+ int x,y,w,h;
+ targetChip->getFrame(&x,&y,&w,&h);
+ pmath->move_square(w/(2*binX) - square_size / (2*binX), h/(2*binY) - square_size / (2*binY));
+ }
+ }
+
+ if (binX != lastBinX)
+ {
+ Vector square_pos = pmath->get_square_pos();
+ double newX = square_pos.x * lastBinX/binX;
+ double newY = square_pos.y * lastBinY/binY;
+ pmath->move_square(newX, newY);
+ pmath->setBinning(binX, binY);
}
pmain_wnd->capture();
@@ -596,8 +619,10 @@ void rguider::guide( void )
Vector star_pos = pmath->find_star_local_pos();
int square_size = pmath->get_square_size();
double ret_x,ret_y,ret_angle;
+ int binx=1,biny=1;
+ targetChip->getBinning(&binx, &biny);
pmath->get_reticle_params(&ret_x, &ret_y, &ret_angle);
- pmath->move_square( round(star_pos.x) - (double)square_size/2, round(star_pos.y) - (double)square_size/2 );
+ pmath->move_square( round(star_pos.x) - (double)square_size/(2*binx), round(star_pos.y) - (double)square_size/(2*biny) );
pmath->set_reticle_params(star_pos.x, star_pos.y, ret_angle);
}
first_frame=false;
@@ -674,15 +699,18 @@ void rguider::setImage(FITSView *image)
guideFrame = image;
if (m_isReady && guideFrame && m_isStarted == false)
- connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
}
void rguider::trackingStarSelected(int x, int y)
{
int square_size = guide_squares[pmath->get_square_index()].size;
+ int binx=1,biny=1;
+ targetChip->getBinning(&binx, &biny);
+
pmath->set_reticle_params(x, y, pmain_wnd->getReticleAngle());
- pmath->move_square(x-square_size/2, y-square_size/2);
+ pmath->move_square(x-square_size/(2*binx), y-square_size/(2*biny));
//disconnect(pimage, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
diff --git a/kstars/ekos/guide/rcalibration.cpp b/kstars/ekos/guide/rcalibration.cpp
index b626430..65af7f9 100644
--- a/kstars/ekos/guide/rcalibration.cpp
+++ b/kstars/ekos/guide/rcalibration.cpp
@@ -44,9 +44,7 @@ rcalibration::rcalibration(cgmath *mathObject, Ekos::Guide *parent)
{
int i;
- ui.setupUi(this);
-
- ui.clearDarkB->setIcon(QIcon::fromTheme("edit-delete"));
+ ui.setupUi(this);
setWindowTitle(i18n("Calibration"));
@@ -80,13 +78,10 @@ rcalibration::rcalibration(cgmath *mathObject, Ekos::Guide *parent)
connect( ui.spinBox_ReticleY, SIGNAL(valueChanged(double)), this, SLOT(onReticleYChanged(double)) );
connect( ui.spinBox_ReticleAngle, SIGNAL(valueChanged(double)), this, SLOT(onReticleAngChanged(double)) );
connect( ui.pushButton_StartCalibration, SIGNAL(clicked()), this, SLOT(onStartReticleCalibrationButtonClick()) );
- connect( ui.autoModeCheck, SIGNAL(stateChanged(int)), this, SLOT(onEnableAutoMode(int)) );
- connect (ui.darkFrameCheck, SIGNAL(toggled(bool)), pmain_wnd, SLOT(setUseDarkFrame(bool)));
+ connect( ui.autoModeCheck, SIGNAL(stateChanged(int)), this, SLOT(onEnableAutoMode(int)) );
connect( ui.autoStarCheck, SIGNAL(toggled(bool)), this, SLOT(toggleAutoSquareSize(bool)));
- connect( ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
- connect( ui.clearDarkB, SIGNAL(clicked()), this, SLOT(clearDarkLibrary()));
+ connect( ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
- ui.darkFrameCheck->setChecked(Options::useDarkFrame());
ui.autoModeCheck->setChecked( Options::useAutoMode() );
ui.spinBox_Pulse->setValue( Options::calibrationPulseDuration());
@@ -326,8 +321,7 @@ bool rcalibration::startCalibration()
Options::setCalibrationPulseDuration(ui.spinBox_Pulse->value());
Options::setCalibrationSquareSizeIndex(ui.comboBox_SquareSize->currentIndex());
Options::setUseAutoMode(ui.autoModeCheck->isChecked());
- Options::setUseTwoAxis(ui.twoAxisCheck->isChecked());
- Options::setUseDarkFrame(ui.darkFrameCheck->isChecked());
+ Options::setUseTwoAxis(ui.twoAxisCheck->isChecked());
Options::setAutoModeIterations(ui.spinBox_DriftTime->value());
Options::setAutoStar(ui.autoStarCheck->isChecked());
if (ui.autoStarCheck->isChecked())
@@ -401,7 +395,7 @@ void rcalibration::reset()
ui.pushButton_StartCalibration->setText( i18n("Start") );
ui.startCalibrationLED->setColor(idleColor);
ui.progressBar->setVisible(false);
- connect(pmath->get_image(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ connect(pmath->get_image(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
}
void rcalibration::calibrateManualReticle( void )
@@ -892,7 +886,7 @@ void rcalibration::trackingStarSelected(int x, int y)
int square_size = guide_squares[pmath->get_square_index()].size;
pmath->set_reticle_params(x, y, ui.spinBox_ReticleAngle->value());
- pmath->move_square(x-square_size/2, y-square_size/2);
+ pmath->move_square(x-square_size/(2*pmath->getBinX()), y-square_size/(2*pmath->getBinY()));
update_reticle_pos(x, y);
@@ -937,8 +931,7 @@ bool rcalibration::setImage(FITSView *image)
{
case CAL_CAPTURE_IMAGE:
case CAL_SELECT_STAR:
- {
- pmath->resize_square(pmath->get_square_index());
+ {
pmain_wnd->appendLogText(i18n("Image captured..."));
ui.captureLED->setColor(okColor);
@@ -947,18 +940,44 @@ bool rcalibration::setImage(FITSView *image)
FITSData *image_data = guideFrame->getImageData();
- setVideoParams(image_data->getWidth(), image_data->getHeight());
-
- QPair<double,double> star = selectAutoStar(guideFrame);
+ setVideoParams(image_data->getWidth(), image_data->getHeight());
if (ui.autoStarCheck->isChecked())
- {
- trackingStarSelected(star.first, star.second);
+ {
+ QPair<double,double> star = selectAutoStar(guideFrame);
+
+ if (star.first == 0 && star.second == 0)
+ {
+ pmain_wnd->appendLogText(i18n("Failed to automatically select a guide star. Please select a guide star..."));
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
+ pmath->move_square(image_data->getWidth()/2-pmath->get_square_size()/2, image_data->getHeight()/2 - pmath->get_square_size()/2);
+ return true;
+ }
+ else
+ trackingStarSelected(star.first, star.second);
return false;
}
else
- connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ {
+ Vector square_pos = pmath->get_square_pos();
+ double currentBin = pmath->getBinX();
+ double lastBin = pmath->getLastBinX();
+
+ if (square_pos.x == 0 && square_pos.y == 0)
+ pmath->move_square(image_data->getWidth()/2-pmath->get_square_size()/2, image_data->getHeight()/2 - pmath->get_square_size()/2);
+ else if (currentBin != lastBin)
+ {
+ double newX = square_pos.x * lastBin/currentBin;
+ double newY = square_pos.y * lastBin/currentBin;
+ //pmath->move_square(newX-pmath->get_square_size()/(2*currentBin), newY- pmath->get_square_size()/(2*currentBin));
+ pmath->move_square(newX, newY);
+ pmath->setBinning(currentBin, currentBin);
+ }
+ else
+ pmath->resize_square(pmath->get_square_index());
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
+ }
}
break;
@@ -1084,11 +1103,6 @@ void rcalibration::setCalibrationAutoSquareSize(bool enable)
ui.autoSquareSizeCheck->setChecked(enable);
}
-void rcalibration::setCalibrationDarkFrame(bool enable)
-{
- ui.darkFrameCheck->setChecked(enable);
-}
-
void rcalibration::setCalibrationParams(int boxSize, int pulseDuration)
{
for (int i=0; i < ui.comboBox_SquareSize->count(); i++)
@@ -1105,17 +1119,3 @@ void rcalibration::toggleAutoSquareSize(bool enable)
{
ui.autoSquareSizeCheck->setEnabled(enable);
}
-
-void rcalibration::clearDarkLibrary()
-{
- QString path = KSPaths::writableLocation(QStandardPaths::GenericDataLocation);
- QDir dir(path);
-
- dir.setNameFilters(QStringList() << "dark-*");
- dir.setFilter(QDir::Files);
-
- foreach(QString dirFile, dir.entryList())
- dir.remove(dirFile);
-
- pmain_wnd->appendLogText(i18n("Dark library files cleared."));
-}
diff --git a/kstars/ekos/guide/rcalibration.h b/kstars/ekos/guide/rcalibration.h
index 865922c..e817a2e 100644
--- a/kstars/ekos/guide/rcalibration.h
+++ b/kstars/ekos/guide/rcalibration.h
@@ -64,8 +64,7 @@ public:
bool isCalibrationSuccessful() { return (calibrationStage == CAL_FINISH); }
bool useAutoStar() { return ui.autoStarCheck->isChecked(); }
- bool useAutoSquareSize() { return ui.autoSquareSizeCheck->isChecked(); }
- bool useDarkFrame() { return ui.darkFrameCheck->isChecked(); }
+ bool useAutoSquareSize() { return ui.autoSquareSizeCheck->isChecked(); }
bool useTwoAxis() { return ui.twoAxisCheck->isChecked(); }
void processCalibration();
@@ -82,8 +81,7 @@ protected slots:
void onReticleYChanged( double val );
void onReticleAngChanged( double val );
void onStartReticleCalibrationButtonClick();
- void toggleAutoSquareSize(bool enable);
- void clearDarkLibrary();
+ void toggleAutoSquareSize(bool enable);
public slots:
void capture();
diff --git a/kstars/ekos/guide/rcalibration.ui b/kstars/ekos/guide/rcalibration.ui
index b4067fe..42c6695 100644
--- a/kstars/ekos/guide/rcalibration.ui
+++ b/kstars/ekos/guide/rcalibration.ui
@@ -219,42 +219,6 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QCheckBox" name="darkFrameCheck">
- <property name="text">
- <string>Use Dark Frame</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="clearDarkB">
- <property name="minimumSize">
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Clear dark library</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/kstars/ekos/sequencejob.cpp b/kstars/ekos/sequencejob.cpp
index e5bd67f..65bc739 100644
--- a/kstars/ekos/sequencejob.cpp
+++ b/kstars/ekos/sequencejob.cpp
@@ -145,7 +145,7 @@ void SequenceJob::prepareCapture()
}
//SequenceJob::CAPTUREResult SequenceJob::capture(bool isDark)
-SequenceJob::CAPTUREResult SequenceJob::capture()
+SequenceJob::CAPTUREResult SequenceJob::capture(bool noCaptureFilter)
{
// If focusing is busy, return error
//if (activeChip->getCaptureMode() == FITS_FOCUS)
@@ -179,33 +179,29 @@ SequenceJob::CAPTUREResult SequenceJob::capture()
}
- if (activeChip->canBin() && activeChip->setBinning(binX, binY) == false)
- {
- status = JOB_ERROR;
+ if (activeChip->canBin() && activeChip->setBinning(binX, binY) == false)
+ {
+ status = JOB_ERROR;
- if (preview == false && statusCell)
- statusCell->setText(statusStrings[status]);
+ if (preview == false && statusCell)
+ statusCell->setText(statusStrings[status]);
- return CAPTURE_BIN_ERROR;
- }
+ return CAPTURE_BIN_ERROR;
+ }
- /*if (isDark)
- {
- activeChip->setFrameType(FRAME_DARK);
- activeChip->setCaptureMode(FITS_CALIBRATE);
- }
- else
- {*/
- activeChip->setFrameType(frameTypeName);
- activeChip->setCaptureMode(FITS_NORMAL);
- activeChip->setCaptureFilter(captureFilter);
- //}
-
- // If filter is different that CCD, send the filter info
- if (activeFilter && activeFilter != activeCCD)
- activeCCD->setFilter(filter);
-
- status = JOB_BUSY;
+ activeChip->setFrameType(frameTypeName);
+ activeChip->setCaptureMode(FITS_NORMAL);
+
+ if (noCaptureFilter)
+ activeChip->setCaptureFilter(FITS_NONE);
+ else
+ activeChip->setCaptureFilter(captureFilter);
+
+ // If filter is different that CCD, send the filter info
+ if (activeFilter && activeFilter != activeCCD)
+ activeCCD->setFilter(filter);
+
+ status = JOB_BUSY;
if (preview == false && statusCell)
statusCell->setText(statusStrings[status]);
diff --git a/kstars/ekos/sequencejob.h b/kstars/ekos/sequencejob.h
index d9d70c3..d30d5fd 100644
--- a/kstars/ekos/sequencejob.h
+++ b/kstars/ekos/sequencejob.h
@@ -36,7 +36,7 @@ class SequenceJob : public QObject
SequenceJob();
~SequenceJob() {}
- CAPTUREResult capture();
+ CAPTUREResult capture(bool noCaptureFilter);
void reset();
void abort();
void done();
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 6c0d4c0..c4f34b6 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -1480,7 +1480,7 @@
<label>Use specified filter index when performing focus regardless of current filter settings.</label>
<default>0</default>
</entry>
- <entry name="FocusDarkFrame" type="Bool">
+ <entry name="UseFocusDarkFrame" type="Bool">
<label>Take a dark frame and subtract it before running autofocus operation.</label>
<default>false</default>
</entry>
@@ -1621,7 +1621,7 @@
<label>Use both axes to perform calibration.</label>
<default>true</default>
</entry>
- <entry name="UseDarkFrame" type="Bool">
+ <entry name="UseGuideDarkFrame" type="Bool">
<label>Take dark frame for autoguider images.</label>
<default>false</default>
</entry>
diff --git a/kstars/org.kde.kstars.Ekos.Guide.xml b/kstars/org.kde.kstars.Ekos.Guide.xml
index b8ae175..fe85b6d 100644
--- a/kstars/org.kde.kstars.Ekos.Guide.xml
+++ b/kstars/org.kde.kstars.Ekos.Guide.xml
@@ -63,7 +63,7 @@
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
- <method name="setCalibrationDarkFrame">
+ <method name="setDarkFrameEnabled">
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
@@ -80,7 +80,7 @@
<arg name="algorithm" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
- <method name="setGuideSubFrame">
+ <method name="setSubFrameEnabled">
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>