Commit 2d728145 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Add support for setting gain within Ekos and in sequence manager files

parent b932f8c8
......@@ -52,7 +52,10 @@
#define MF_RA_DIFF_LIMIT 4
#define MAX_CAPTURE_RETRIES 3
#define SQ_FORMAT_VERSION 1.6
// Current Sequence File Format:
#define SQ_FORMAT_VERSION 1.7
// We accept file formats with version back to:
#define SQ_COMPAT_VERSION 1.6
namespace Ekos
{
......@@ -670,6 +673,24 @@ void Capture::checkCCD(int ccdNum)
}
}
gainLabel->setEnabled(currentCCD->hasGain());
gainIN->setEnabled(currentCCD->hasGain());
if (gainIN->isEnabled())
{
double gain=0, min=0,max=0,step=1;
currentCCD->getGainMinMaxStep(&min, &max, &step);
if (currentCCD->getGain(&gain))
{
gainIN->setMinimum(min);
gainIN->setMaximum(max);
if (step > 0)
gainIN->setSingleStep(step);
gainIN->setValue(gain);
}
}
else
gainIN->clear();
liveVideoB->setEnabled(currentCCD->hasVideoStream());
setVideoStreamEnabled(currentCCD->isStreamingEnabled());
......@@ -1637,6 +1658,9 @@ void Capture::addJob(bool preview)
if (ISOCombo->isEnabled())
job->setISOIndex(ISOCombo->currentIndex());
if (gainIN->isEnabled())
job->setGain(gainIN->value());
job->setTransforFormat(static_cast<ISD::CCD::TransferFormat>(transferFormatCombo->currentIndex()));
job->setPreview(preview);
......@@ -2393,7 +2417,7 @@ bool Capture::loadSequenceQueue(const QString &fileURL)
if (root)
{
double sqVersion= atof(findXMLAttValu(root, "version"));
if (sqVersion < SQ_FORMAT_VERSION)
if (sqVersion < SQ_COMPAT_VERSION)
{
appendLogText(i18n("Deprecated sequence file format version %1. Please construct a new sequence file.", sqVersion));
return false;
......@@ -2570,6 +2594,11 @@ bool Capture::processJobInfo(XMLEle * root)
if (ISOCombo->isEnabled())
ISOCombo->setCurrentIndex(atoi(pcdataXMLEle(ep)));
}
else if (!strcmp(tagXMLEle(ep), "Gain"))
{
if (gainIN->isEnabled())
gainIN->setValue(atof(pcdataXMLEle(ep)));
}
else if (!strcmp(tagXMLEle(ep), "FormatIndex"))
{
transferFormatCombo->setCurrentIndex(atoi(pcdataXMLEle(ep)));
......@@ -2784,6 +2813,8 @@ bool Capture::saveSequenceQueue(const QString &path)
outstream << "<RemoteDirectory>" << job->getRemoteDir() << "</RemoteDirectory>" << endl;
if (job->getISOIndex() != -1)
outstream << "<ISOIndex>" << (job->getISOIndex()) << "</ISOIndex>" << endl;
if (job->getGain() != -1)
outstream << "<Gain>" << (job->getGain()) << "</Gain>" << endl;
outstream << "<FormatIndex>" << (job->getTransforFormat()) << "</FormatIndex>" << endl;
outstream << "<Calibration>" << endl;
......@@ -2897,6 +2928,9 @@ void Capture::syncGUIToJob(SequenceJob * job)
if (ISOCombo->isEnabled())
ISOCombo->setCurrentIndex(job->getISOIndex());
if (gainIN->isEnabled())
gainIN->setValue(job->getGain());
transferFormatCombo->setCurrentIndex(job->getTransforFormat());
}
......
......@@ -236,6 +236,64 @@
<property name="spacing">
<number>3</number>
</property>
<item row="6" column="3">
<widget class="QLabel" name="textLabel1_14">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="textLabel1_9">
<property name="toolTip">
<string>Horizontal and Vertical binning</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Binning:</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLabel" name="textLabel1_16">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>H:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSpinBox" name="countIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="6" column="6">
<widget class="QPushButton" name="resetFrameB">
<property name="sizePolicy">
......@@ -270,68 +328,26 @@
</property>
</widget>
</item>
<item row="1" column="5" colspan="2">
<widget class="QSpinBox" name="delayIN">
<item row="0" column="5" colspan="2">
<widget class="QComboBox" name="FilterPosCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>3600</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="textLabel1_12">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Frame:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="textLabel1_17">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="0" column="5" colspan="2">
<widget class="QComboBox" name="FilterPosCombo">
<item row="6" column="4" colspan="2">
<widget class="QSpinBox" name="frameYIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="textLabel1_19">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="exposureIN">
<property name="sizePolicy">
......@@ -354,26 +370,16 @@
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLabel" name="textLabel1_16">
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_4">
<property name="toolTip">
<string/>
<string>Number of images to capture</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>H:</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="frameTypeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<string>Count:</string>
</property>
</widget>
</item>
......@@ -399,8 +405,31 @@
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QLabel" name="textLabel1_11">
<item row="7" column="4" colspan="2">
<widget class="QSpinBox" name="frameHIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="exposureLabel_2">
<property name="toolTip">
<string>Set the exposure time in seconds for individual images, if applicable</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Exposure:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="textLabel1_13">
<property name="toolTip">
<string/>
</property>
......@@ -408,45 +437,45 @@
<string/>
</property>
<property name="text">
<string>V:</string>
<string>X:</string>
</property>
</widget>
</item>
<item row="6" column="4" colspan="2">
<widget class="QSpinBox" name="frameYIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Format:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QSpinBox" name="frameXIN">
<item row="7" column="2">
<widget class="QSpinBox" name="frameWIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>99</number>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<widget class="QLabel" name="textLabel1_8">
<item row="6" column="0">
<widget class="QLabel" name="textLabel1_12">
<property name="toolTip">
<string>Delay in seconds between consecutive images</string>
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Delay:</string>
<string>Frame:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="textLabel1_15">
<item row="8" column="1">
<widget class="QLabel" name="textLabel1_10">
<property name="toolTip">
<string/>
</property>
......@@ -454,23 +483,7 @@
<string/>
</property>
<property name="text">
<string>W:</string>
</property>
</widget>
</item>
<item row="3" column="5" colspan="2">
<widget class="QComboBox" name="ISOCombo">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>ISO settings</string>
<string>H:</string>
</property>
</widget>
</item>
......@@ -484,77 +497,79 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_4">
<item row="1" column="5" colspan="2">
<widget class="QSpinBox" name="delayIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>3600</number>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="textLabel1_15">
<property name="toolTip">
<string>Number of images to capture</string>
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Count:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Format:</string>
<string>W:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="transferFormatCombo">
<property name="toolTip">
<string>Image Transfer Format</string>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="frameTypeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>FITS</string>
</property>
</item>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSpinBox" name="countIN">
<item row="8" column="4" colspan="2">
<widget class="QSpinBox" name="binYIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Vertical binning</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
<number>10</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="exposureLabel_2">
<item row="1" column="3" colspan="2">
<widget class="QLabel" name="textLabel1_8">
<property name="toolTip">
<string>Set the exposure time in seconds for individual images, if applicable</string>
<string>Delay in seconds between consecutive images</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Exposure:</string>
<string>Delay:</string>
</property>
</widget>
</item>
<item row="7" column="4" colspan="2">
<widget class="QSpinBox" name="frameHIN">
<item row="6" column="2">
<widget class="QSpinBox" name="frameXIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -563,8 +578,8 @@
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="textLabel1_14">
<item row="8" column="3">
<widget class="QLabel" name="textLabel1_11">
<property name="toolTip">
<string/>
</property>
......@@ -572,25 +587,25 @@
<string/>
</property>
<property name="text">
<string>Y:</string>
<string>V:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="textLabel1_9">
<item row="7" column="0">
<widget class="QLabel" name="textLabel1_19">
<property name="toolTip">
<string>Horizontal and Vertical binning</string>
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Binning:</string>
<string>Size:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="textLabel1_10">
<item row="5" column="0">
<widget class="QLabel" name="textLabel1_17">
<property name="toolTip">
<string/>
</property>
......@@ -598,12 +613,15 @@
<string/>
</property>
<property name="text">
<string>H:</string>
<string>Type:</string>
</property>
</widget>
</item>
<item row="8" column="4" colspan="2">
<widget class="QSpinBox" name="binYIN">
<item row="3" column="5" colspan="2">
<widget class="QComboBox" name="ISOCombo">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -611,17 +629,25 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Vertical binning</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
<string>ISO settings</string>
</property>
<property name="value">
<number>1</number>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="transferFormatCombo">
<property name="toolTip">
<string>Image Transfer Format</string>
</property>
<item>
<property name="text">
<string>FITS</string>
</property>
</item>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3" colspan="2">
......@@ -637,33 +663,17 @@
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QSpinBox" name="frameWIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>99</number>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="textLabel1_13">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<item row="5" column="3" colspan="2">
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>X:</string>
<string>Gain:</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="4">
<item row="5" column="5" colspan="2">
<widget class="QDoubleSpinBox" name="gainIN"/>
</item>
<item row="7" column="6" rowspan="2">
<widget class="QPushButton" name="calibrationB">