summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2015-06-26 14:15:43 +0300
committerJasem Mutlaq <[email protected]>2015-06-26 14:15:43 +0300
commitc277bf16372271b8b1a49d7a150d4e05c4f4700f (patch)
tree0a586c3b4716e07d465ac058b5a119e8b0928f59
parent8d24dc3f9eb614a1f21857213b1295f329e502e5 (diff)
Improving the flat ADU algorithm and checking for out of bound values
-rw-r--r--kstars/ekos/capture.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index 1929013..bd263fb 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -1013,6 +1013,15 @@ void Capture::newFITS(IBLOB *bp)
double nextExposure = setCurrentADU(currentADU);
+ if (nextExposure <= 0)
+ {
+ appendLogText(xi18n("Unable to calculate optimal exposure settings, please take the flats manually."));
+ activeJob->setTargetADU(0);
+ ADUValue->setValue(0);
+ stopSequence();
+ return;
+ }
+
appendLogText(xi18n("Current ADU is %1% Next exposure is %2 seconds.", QString::number(currentADU, 'g', 2), QString::number(nextExposure, 'g', 2)));
activeJob->setExposure(nextExposure);
@@ -2615,21 +2624,32 @@ double Capture::setCurrentADU(double value)
ADURaw2 = value;
}
+ qDebug() << "Exposure #1 (" << ExpRaw1 << "," << ADURaw1 << ") Exspoure #2 (" << ExpRaw2 << "," << ADURaw2 << ")";
+
// If we don't have the 2nd point, let's take another exposure with value relative to what we have now
if (ADURaw2 == -1 || ExpRaw2 == -1 || (ADURaw1 == ADURaw2))
{
if (value < activeJob->getTargetADU())
- nextExposure = activeJob->getExposure()*10;
+ nextExposure = activeJob->getExposure()*1.5;
else
- nextExposure = activeJob->getExposure()*0.1;
+ nextExposure = activeJob->getExposure()*.75;
+
+ qDebug() << "Next Exposure: " << nextExposure;
return nextExposure;
}
- ADUSlope = (ExpRaw2 - ExpRaw1) / (ADURaw2 - ADURaw1);
+ if (fabs(ADURaw2 - ADURaw1) < 0.01)
+ ADUSlope=1e-6;
+ else
+ ADUSlope = (ExpRaw2 - ExpRaw1) / (ADURaw2 - ADURaw1);
+
+ qDebug() << "ADU Slope: " << ADUSlope;
nextExposure = ADUSlope * (activeJob->getTargetADU() - ADURaw2) + ExpRaw2;
+ qDebug() << "Next Exposure: " << nextExposure;
+
return nextExposure;
}