gui 12 bit mode done

This commit is contained in:
maliakal_d 2022-02-17 17:33:16 +01:00
parent 40a9dce7e0
commit d2731c77a3
4 changed files with 53 additions and 7 deletions

View File

@ -97,6 +97,11 @@
<string>65535</string>
</property>
</item>
<item>
<property name="text">
<string>4095</string>
</property>
</item>
<item>
<property name="text">
<string>255</string>

View File

@ -69,5 +69,11 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
bool isVisibleFixG0{false};
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
enum {
DYNAMICRANGE_32,
DYNAMICRANGE_16,
DYNAMICRANGE_12,
DYNAMICRANGE_8,
DYNAMICRANGE_4
};
};

View File

@ -1064,6 +1064,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
// mythen3 / gotthard2 debugging
int discardBits = numDiscardBits;
uint16_t temp = 0;
switch (dr) {
case 4:
@ -1083,6 +1084,28 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
}
break;
case 12:
for (ichan = 0; ichan < size; ++ichan) {
// first 12 bit pixel
// lsb (8 bytes)
temp = (*((u_int8_t *)source)) & 0xFF;
++source;
// msb (4 bytes)
temp |= (((*((u_int8_t *)source)) & 0xF) << 8);
dest[ichan] = (double)temp;
// second 12bit pixel
++ichan;
// lsb (4 bytes)
temp = (((*((u_int8_t *)source)) & 0xF0) >> 4);
++source;
// msb (8 bytes)
temp |= (((*((u_int8_t *)source)) & 0xFF) << 4);
++source;
dest[ichan] = (double)temp;
}
break;
case 16:
if (detType == slsDetectorDefs::JUNGFRAU ||
detType == slsDetectorDefs::GOTTHARD2) {

View File

@ -60,13 +60,19 @@ void qTabSettings::SetupWidgetWindow() {
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
if (model) {
QModelIndex index;
QStandardItem *item;
index =
model->index(DYNAMICRANGE_4, comboDynamicRange->modelColumn(),
comboDynamicRange->rootModelIndex());
item = model->itemFromIndex(index);
item->setEnabled(false);
int dr = DYNAMICRANGE_4;
for (int i = 0; i != 2; ++i) {
// disable dr 4
QModelIndex index =
model->index(dr, comboDynamicRange->modelColumn(),
comboDynamicRange->rootModelIndex());
item = model->itemFromIndex(index);
item->setEnabled(false);
// disable dr 12
dr = DYNAMICRANGE_12;
}
}
} else if (detType == slsDetectorDefs::EIGER) {
lblDynamicRange->setEnabled(true);
@ -305,6 +311,9 @@ void qTabSettings::GetDynamicRange() {
case 16:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_16);
break;
case 12:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_12);
break;
case 8:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_8);
break;
@ -333,6 +342,9 @@ void qTabSettings::SetDynamicRange(int index) {
case DYNAMICRANGE_16:
det->setDynamicRange(16);
break;
case DYNAMICRANGE_12:
det->setDynamicRange(12);
break;
case DYNAMICRANGE_8:
det->setDynamicRange(8);
break;