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

If user canceled dark frame capture then we set the options to off

parent e1beafd0
......@@ -245,7 +245,7 @@ template<typename T> bool DarkLibrary::subtract(FITSData *darkData, FITSView *li
}
void DarkLibrary::captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY)
bool DarkLibrary::captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY)
{
QStringList shutterfulCCDs = Options::shutterfulCCDs();
QStringList shutterlessCCDs = Options::shutterlessCCDs();
......@@ -275,13 +275,13 @@ void DarkLibrary::captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetIm
if (hasNoShutter)
{
if ( (KMessageBox::warningContinueCancel(NULL, i18n("Cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"),
KStandardGuiItem::cont(), KStandardGuiItem::cancel(), "dark_exposure_dialog_notification"))
== KMessageBox::Cancel)
if ( KMessageBox::warningContinueCancel(NULL, i18n("Cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"),
KStandardGuiItem::cont(), KStandardGuiItem::cancel(), "dark_exposure_dialog_notification") == KMessageBox::Cancel)
{
emit newLog(i18n("Dark frame capture cancelled."));
disconnect(targetChip->getCCD(), SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
emit darkFrameCompleted(false);
return false;
}
}
......@@ -300,6 +300,8 @@ void DarkLibrary::captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetIm
emit newLog(i18n("Capturing dark frame..."));
targetChip->capture(duration);
return true;
}
void DarkLibrary::newFITS(IBLOB *bp)
......
......@@ -34,7 +34,8 @@ public:
FITSData * getDarkFrame(ISD::CCDChip *targetChip, double duration);
bool subtract(FITSData *darkData, FITSView *lightImage, FITSScale filter, uint16_t offsetX, uint16_t offsetY);
void captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY);
// Return false if canceled. True if dark capture proceeds
bool captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY);
signals:
void darkFrameCompleted(bool);
......
......@@ -977,7 +977,10 @@ void Focus::newFITS(IBLOB *bp)
if (darkData)
DarkLibrary::Instance()->subtract(darkData, focusView, defaultScale, offsetX, offsetY);
else
DarkLibrary::Instance()->captureAndSubtract(targetChip, focusView, exposureIN->value(), offsetX, offsetY);
{
bool rc = DarkLibrary::Instance()->captureAndSubtract(targetChip, focusView, exposureIN->value(), offsetX, offsetY);
darkFrameCheck->setChecked(rc);
}
return;
}
......
......@@ -2076,7 +2076,10 @@ bool Guide::executeOneOperation(GuideState operation)
if (darkData)
DarkLibrary::Instance()->subtract(darkData, guideView, targetChip->getCaptureFilter(), offsetX, offsetY);
else
DarkLibrary::Instance()->captureAndSubtract(targetChip, guideView, exposureIN->value(), offsetX, offsetY);
{
bool rc = DarkLibrary::Instance()->captureAndSubtract(targetChip, guideView, exposureIN->value(), offsetX, offsetY);
setDarkFrameEnabled(rc);
}
}
}
break;
......
......@@ -960,7 +960,7 @@ void cgmath::process_axes( void )
void cgmath::performProcessing( void )
{
Vector arc_star_pos, arc_reticle_pos, pos, p;
Vector arc_star_pos, arc_reticle_pos;
// do nothing if suspended
if( suspended )
......
......@@ -769,12 +769,13 @@ bool InternalGuider::processGuiding()
// do pulse
out = pmath->getOutputParameters();
if (out->pulse_length[GUIDE_RA] == Options::rAMaximumPulse() || out->pulse_length[GUIDE_DEC] == Options::dECMaximumPulse())
// If within 90% of max pulse repeatedly, let's abort
if (out->pulse_length[GUIDE_RA] >= (0.9 * Options::rAMaximumPulse()) || out->pulse_length[GUIDE_DEC] >= (0.9 * Options::dECMaximumPulse()))
maxPulseCounter++;
else
maxPulseCounter=0;
if (maxPulseCounter > 3)
if (maxPulseCounter >= 3)
{
emit newLog(i18n("Lost track of the guide star. Aborting guiding..."));
abort();
......
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