adcinvert for jungfrau, gui for jungfrau dacs

This commit is contained in:
2019-10-30 12:28:51 +01:00
parent 4aba8b6ac0
commit 11ea071543
13 changed files with 66 additions and 106 deletions

View File

@ -643,27 +643,6 @@ Displays minimum, maximum and sum of values for each plot.
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkADCInvert">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Displays minimum, maximum and sum of values for each plot.
&lt;nobr&gt;</string>
</property>
<property name="text">
<string>ADC Invert</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">

View File

@ -55,7 +55,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void ResetAccumulate();
void DisplayStatistics(bool enable);
void EnableGainPlot(bool enable);
void EnableADCInvert(bool enable);
void ClonePlot();
void SavePlot();
@ -148,7 +147,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
QString fileSaveName{"Image"};
bool hasGainData{false};
bool isGainDataExtracted{false};
bool isADCInvert{false};
bool disableZoom{false};
int progress{0};

View File

@ -417,11 +417,6 @@ void qDrawPlot::EnableGainPlot(bool enable) {
hasGainData = enable;
}
void qDrawPlot::EnableADCInvert(bool enable) {
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " ADC Invert";
isADCInvert = enable;
}
void qDrawPlot::SetSaveFileName(QString val) {
FILE_LOG(logDEBUG) << "Setting Clone/Save File Name to " << val.toAscii().constData();
fileSaveName = val;
@ -904,62 +899,20 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
// show gain plot
if (gaindest != NULL) {
// adcinvert
if (isADCInvert) {
for (ichan = 0; ichan < size; ++ichan) {
uint16_t temp = (*((u_int16_t *)source));
if (temp == 0xFFFF) {
gaindest[ichan] = 0xFFFF;
dest[ichan] = 0xFFFF;
} else {
gaindest[ichan] = ((temp & 0xC000) >> 14);
dest[ichan] = 0x4000 - (temp & 0x3FFF);
}
source += 2;
}
}
// normal
else {
for (ichan = 0; ichan < size; ++ichan) {
uint16_t temp = (*((u_int16_t *)source));
if (temp == 0xFFFF) {
gaindest[ichan] = 0xFFFF;
dest[ichan] = 0xFFFF;
} else {
gaindest[ichan] = ((temp & 0xC000) >> 14);
dest[ichan] = (temp & 0x3FFF);
}
source += 2;
}
for (ichan = 0; ichan < size; ++ichan) {
uint16_t temp = (*((u_int16_t *)source));
gaindest[ichan] = ((temp & 0xC000) >> 14);
dest[ichan] = (temp & 0x3FFF);
source += 2;
}
}
// only data plot
else {
// adcinvert
if (isADCInvert) {
for (ichan = 0; ichan < size; ++ichan) {
uint16_t temp = (*((u_int16_t *)source));
if (temp == 0xFFFF) {
dest[ichan] = 0xFFFF;
} else {
dest[ichan] = 0x4000 - (temp & 0x3FFF);
}
source += 2;
}
for (ichan = 0; ichan < size; ++ichan) {
dest[ichan] = ((*((u_int16_t *)source)) & 0x3FFF);
source += 2;
}
// normal
else {
for (ichan = 0; ichan < size; ++ichan) {
uint16_t temp = (*((u_int16_t *)source));
if (temp == 0xFFFF) {
dest[ichan] = 0xFFFF;
} else {
dest[ichan] = (temp & 0x3FFF);
}
source += 2;
}
}
}
break;
}

View File

@ -276,14 +276,30 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
break;
case slsDetectorDefs::JUNGFRAU:
if (index >= 0 && index < (int)dacWidgets.size()) {
return (slsDetectorDefs::dacIndex)index;
}
if (index == (int)dacWidgets.size()) {
switch (index) {
case 0:
return slsDetectorDefs::VB_COMP;
case 1:
return slsDetectorDefs::VDD_PROT;
case 2:
return slsDetectorDefs::VIN_COM;
case 3:
return slsDetectorDefs::VREF_PRECH;
case 4:
return slsDetectorDefs::VB_PIXBUF;
case 5:
return slsDetectorDefs::VB_DS;
case 6:
return slsDetectorDefs::VREF_DS;
case 7:
return slsDetectorDefs::VREF_COMP;
case 8:
return slsDetectorDefs::TEMPERATURE_ADC;
}
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
}
break;
case slsDetectorDefs::MOENCH:
if (index >= 0 && index < (int)dacWidgets.size()) {
return (slsDetectorDefs::dacIndex)index;

View File

@ -67,7 +67,6 @@ void qTabPlot::SetupWidgetWindow() {
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
chkGainPlot->setEnabled(true);
chkADCInvert->setEnabled(true);
break;
default:
break;
@ -130,9 +129,6 @@ void qTabPlot::Initialization() {
// gap pixels
if (chkGapPixels->isEnabled())
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
// adc invert
if (chkADCInvert->isEnabled())
connect(chkADCInvert, SIGNAL(toggled(bool)), plot, SLOT(EnableADCInvert(bool)));
// Save, clone
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));