mythen3 gui: discard bits option for debugging

This commit is contained in:
2019-11-18 18:33:16 +01:00
parent dfc886a65b
commit 1539326fda
6 changed files with 105 additions and 17 deletions

View File

@ -135,7 +135,7 @@ void qDetectorMain::SetUpWidgetWindow() {
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
tabAdvanced = sls::make_unique<qTabAdvanced>(this, det.get());
tabAdvanced = sls::make_unique<qTabAdvanced>(this, det.get(), plot.get());
tabDebugging = sls::make_unique<qTabDebugging>(this, det.get());
tabDeveloper = sls::make_unique<qTabDeveloper>(this, det.get());

View File

@ -412,6 +412,11 @@ void qDrawPlot::DisplayStatistics(bool enable) {
displayStatistics = enable;
}
void qDrawPlot::SetNumDiscardBits(int value) {
FILE_LOG(logINFO) << "Setting number of bits to discard: " << value;
numDiscardBits = value;
}
void qDrawPlot::EnableGainPlot(bool enable) {
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot";
hasGainData = enable;
@ -874,6 +879,9 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
int halfbyte = 0;
char cbyte = '\0';
// mythen 3 debugging
int discardBits = numDiscardBits;
switch (dr) {
case 4:
@ -926,7 +934,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
default:
for (ichan = 0; ichan < size; ++ichan) {
dest[ichan] = *((u_int32_t *)source);
dest[ichan] = ((*((u_int32_t *)source)) >> discardBits);
source += 4;
}
break;

View File

@ -1,11 +1,12 @@
#include "qTabAdvanced.h"
#include "qDefs.h"
#include "qDrawPlot.h"
#include "network_utils.h"
#include <iostream>
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector)
: QWidget(parent), det(detector) {
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
: QWidget(parent), det(detector), plot(p) {
setupUi(this);
SetupWidgetWindow();
FILE_LOG(logDEBUG) << "Advanced ready";
@ -28,6 +29,9 @@ void qTabAdvanced::SetupWidgetWindow() {
case slsDetectorDefs::GOTTHARD:
tab_roi->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true);
default:
break;
}
@ -105,6 +109,12 @@ void qTabAdvanced::Initialization() {
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubDeadTime()));
}
// throw bits
if (lblDiscardBits->isEnabled()) {
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
SLOT(SetNumDiscardBits(int)));
}
}
void qTabAdvanced::PopulateDetectors() {