This commit is contained in:
maliakal_d 2019-07-12 18:24:23 +02:00
parent 5e24591295
commit 0f2641f9fa
11 changed files with 48 additions and 34 deletions

View File

@ -200,14 +200,15 @@ void qDrawPlot::SetupPlots() {
// default display data // default display data
for (unsigned int px = 0; px < nPixelsX; ++px) { for (unsigned int px = 0; px < nPixelsX; ++px) {
datax1d[px] = px; datax1d[px] = px;
datay1d[0][px] = 0; datay1d[0][px] = px;
} }
// add a hist // add a hist
DetachHists();
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[0]); SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[0]);
h->SetLineColor(0); h->SetLineColor(0);
SetStyleandSymbol(h); SetStyleandSymbol(h);
hists1d.append(h); hists1d.append(h);
h->Attach(plot1d);
plot1d->DisableZoom(true);
// setup 2d plot // setup 2d plot
plot2d = new SlsQt2DPlotLayout(boxPlot); plot2d = new SlsQt2DPlotLayout(boxPlot);
@ -792,7 +793,7 @@ void qDrawPlot::Get1dData(double* rawData) {
if (currentPersistency) { if (currentPersistency) {
// allocate // allocate
for(int i = datay1d.size(); i <= persistency; ++i) { for(int i = datay1d.size(); i <= persistency; ++i) {
datay1d[i] = new double [nPixelsX]; datay1d.push_back(new double [nPixelsX]);
SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]); SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]);
h->SetLineColor(i); h->SetLineColor(i);
SetStyleandSymbol(h); SetStyleandSymbol(h);

View File

@ -159,7 +159,7 @@ void qTabDeveloper::Initialization() {
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
} }
if (spinHV != nullptr) { if (spinHV != nullptr) {
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
} }
} }
@ -271,8 +271,8 @@ void qTabDeveloper::CreateHVWidget() {
// jungfrau, moench (range of values) // jungfrau, moench (range of values)
else { else {
spinHV = new QSpinBox(boxDacs); spinHV = new QSpinBox(boxDacs);
spinDacs[numDACWidgets]->setMinimum(-1); spinHV->setMinimum(-1);
spinDacs[numDACWidgets]->setMaximum(HV_MAX); spinHV->setMaximum(HV_MAX);
spinHV->setToolTip("<nobr>Set high voltage to 0 or 60 - 200V</nobr>"); spinHV->setToolTip("<nobr>Set high voltage to 0 or 60 - 200V</nobr>");
lblHV->setToolTip(spinHV->toolTip()); lblHV->setToolTip(spinHV->toolTip());
dacLayout->addWidget(spinHV, (int)(numDACWidgets / 2), 2); dacLayout->addWidget(spinHV, (int)(numDACWidgets / 2), 2);
@ -341,7 +341,7 @@ void qTabDeveloper::GetHighVoltage() {
FILE_LOG(logDEBUG) << "Getting High Voltage"; FILE_LOG(logDEBUG) << "Getting High Voltage";
if (spinHV != nullptr) { if (spinHV != nullptr) {
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
} }
if (comboHV != nullptr) { if (comboHV != nullptr) {
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
@ -391,7 +391,7 @@ void qTabDeveloper::GetHighVoltage() {
} CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage") } CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
if (spinHV != nullptr) { if (spinHV != nullptr) {
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
} }
if (comboHV != nullptr) { if (comboHV != nullptr) {
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));

View File

@ -1824,13 +1824,11 @@ void readFrame(int *ret, char *mess){
} }
// frames left to give status // frames left to give status
*ret = (int)OK;
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1; int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
if ( retval > -1) { if ( retval > -1) {
*ret = (int)FAIL; FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
sprintf(mess,"No data and run stopped: %lld frames left\n",(long long int)retval);
FILE_LOG(logERROR, (mess));
} else { } else {
*ret = (int)OK;
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
} }
} }

View File

@ -1013,28 +1013,38 @@ void setNumberofUDPInterfaces(int val) {
FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 1\n")); FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 1\n"));
bus_w(addr, bus_r(addr) &~ CONFIG_OPRTN_MDE_2_X_10GbE_MSK); bus_w(addr, bus_r(addr) &~ CONFIG_OPRTN_MDE_2_X_10GbE_MSK);
} }
FILE_LOG(logINFO, ("config reg:0x%x\n", bus_r(addr)));
} }
int getNumberofUDPInterfaces() { int getNumberofUDPInterfaces() {
FILE_LOG(logINFO, ("config reg:0x%x\n", bus_r(CONFIG_REG)));
FILE_LOG(logINFO, ("config reg 2x10 :0x%x %d\n",
CONFIG_OPRTN_MDE_2_X_10GbE_MSK,
bus_r(CONFIG_REG)|CONFIG_OPRTN_MDE_2_X_10GbE_MSK));
// return 2 if enabled, else 1 // return 2 if enabled, else 1
return ((bus_r(CONFIG_REG) | CONFIG_OPRTN_MDE_2_X_10GbE_MSK) ? 2 : 1);
return ((bus_r(CONFIG_REG) & CONFIG_OPRTN_MDE_2_X_10GbE_MSK) ? 2 : 1);
} }
void selectPrimaryInterface(int val) { void selectPrimaryInterface(int val) {
uint32_t addr = CONFIG_REG; uint32_t addr = CONFIG_REG;
// inner (user input: 0) // outer (user input: 0)
if (val == 0) { if (val == 0) {
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 0 (Outer)\n")); FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 0 (Outer)\n"));
bus_w(addr, bus_r(addr) &~ CONFIG_INNR_PRIMRY_INTRFCE_MSK); bus_w(addr, bus_r(addr) &~ CONFIG_INNR_PRIMRY_INTRFCE_MSK);
} }
// outer (user input: 1) // inner (user input: 1)
else { else {
FILE_LOG(logINFOBLUE, ("Setting Secondary Interface: 1 (Inner)\n")); FILE_LOG(logINFOBLUE, ("Setting Secondary Interface: 1 (Inner)\n"));
bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK); bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK);
} }
} }
int getPrimaryInterface() {
return ((bus_r(CONFIG_REG) & CONFIG_INNR_PRIMRY_INTRFCE_MSK) ? 1 : 0);
}
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport) { void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport) {
// start addr // start addr
@ -1128,9 +1138,9 @@ int configureMAC(int numInterfaces, int selInterface,
uint32_t sourceport = DEFAULT_TX_UDP_PORT; uint32_t sourceport = DEFAULT_TX_UDP_PORT;
FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces)); FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
FILE_LOG(logINFO, ("\tInterface : %d\n\n", selInterface)); FILE_LOG(logINFO, ("\tInterface : %d %s\n\n", selInterface, (selInterface ? "Inner" : "Outer")));
FILE_LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": "")); FILE_LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": (selInterface ? "Not Used" : "Used")));
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip)); (sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
@ -1156,7 +1166,7 @@ int configureMAC(int numInterfaces, int selInterface,
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport)); FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1; uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1;
FILE_LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": "Not used")); FILE_LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": (selInterface ? "Used" : "Not Used")));
FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n", FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n",
(sourceip2>>24)&0xff,(sourceip2>>16)&0xff,(sourceip2>>8)&0xff,(sourceip2)&0xff, sourceip2)); (sourceip2>>24)&0xff,(sourceip2>>16)&0xff,(sourceip2>>8)&0xff,(sourceip2)&0xff, sourceip2));
FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
@ -1214,14 +1224,16 @@ int setDetectorPosition(int pos[]) {
int ret = OK; int ret = OK;
int innerPos[2] = {pos[X], pos[Y]}; int innerPos[2] = {pos[X], pos[Y]};
int outerPos[2] = {pos[X], pos[Y]}; int outerPos[2] = {pos[X], pos[Y]};
int selInterface = getPrimaryInterface();
int numInterfaces = getNumberofUDPInterfaces(); int numInterfaces = getNumberofUDPInterfaces();
if (numInterfaces == 1) { if (numInterfaces == 1) {
FILE_LOG(logDEBUG1, ("Setting detector position: (%d, %d)\n", innerPos[X], innerPos[Y])); FILE_LOG(logDEBUG, ("Setting detector position: 1 Interface %s \n(%d, %d)\n",
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
} }
else { else {
++outerPos[X]; ++outerPos[X];
FILE_LOG(logDEBUG1, ("Setting detector position:\n" FILE_LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n"
" inner top(%d, %d), outer bottom(%d, %d)\n" " inner top(%d, %d), outer bottom(%d, %d)\n"
, innerPos[X], innerPos[Y], outerPos[X], outerPos[Y])); , innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
} }
@ -1250,11 +1262,11 @@ int setDetectorPosition(int pos[]) {
if (ret == OK) { if (ret == OK) {
if (numInterfaces == 1) { if (numInterfaces == 1) {
FILE_LOG(logINFO, ("Position set to [%d, %d]\n", innerPos[X], innerPos[Y])); FILE_LOG(logINFOBLUE, ("Position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
} }
else { else {
FILE_LOG(logINFO, (" Inner (top) position set to [%d, %d]\n", innerPos[X], innerPos[Y])); FILE_LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
FILE_LOG(logINFO, (" Outer (bottom) position set to [%d, %d]\n", outerPos[X], outerPos[Y])); FILE_LOG(logINFOBLUE, (" Outer (bottom) position set to [%d, %d]\n", outerPos[X], outerPos[Y]));
} }
} }
return ret; return ret;
@ -1784,14 +1796,13 @@ void readFrame(int *ret, char *mess){
usleep(500); usleep(500);
} }
*ret = (int)OK;
// frames left to give status // frames left to give status
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1; int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
if ( retval > 0) { if ( retval > 0) {
*ret = (int)FAIL; FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
sprintf(mess,"No data and run stopped: %lld frames left\n",(long long int)retval);
FILE_LOG(logERROR, (mess));
} else { } else {
*ret = (int)OK;
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
} }
} }

View File

@ -222,6 +222,7 @@ void calcChecksum(mac_conf* mac, int sourceip, int destip);
void setNumberofUDPInterfaces(int val); void setNumberofUDPInterfaces(int val);
int getNumberofUDPInterfaces(); int getNumberofUDPInterfaces();
void selectPrimaryInterface(int val); void selectPrimaryInterface(int val);
int getPrimaryInterface();
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport); void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport);
void calcChecksum(udp_header* udp); void calcChecksum(udp_header* udp);
#endif #endif

View File

@ -3464,8 +3464,11 @@ void multiSlsDetector::readFrameFromReceiver() {
} }
// free resources // free resources
if (image != nullptr)
delete[] image; delete[] image;
if (multiframe)
delete[] multiframe; delete[] multiframe;
if (multigappixels)
delete [] multigappixels; delete [] multigappixels;
} }

View File

@ -1443,7 +1443,7 @@ int slsDetector::configureMAC() {
// col for horiz. udp ports // col for horiz. udp ports
pos[1] = (detId / max) * ((shm()->myDetectorType == EIGER) ? 2 : 1); pos[1] = (detId / max) * ((shm()->myDetectorType == EIGER) ? 2 : 1);
// pos[2] (z is reserved) // pos[2] (z is reserved)
FILE_LOG(logDEBUG1) << "Detector [" << detId << "] - (" << pos[0] << "," FILE_LOG(logDEBUG) << "Detector [" << detId << "] - (" << pos[0] << ","
<< pos[1] << ")"; << pos[1] << ")";
snprintf(args[12], array_size, "%x", pos[0]); snprintf(args[12], array_size, "%x", pos[0]);
snprintf(args[13], array_size, "%x", pos[1]); snprintf(args[13], array_size, "%x", pos[1]);

View File

@ -5,6 +5,6 @@
#define APIRECEIVER 0x190604 #define APIRECEIVER 0x190604
#define APIGUI 0x190405 #define APIGUI 0x190405
#define APICTB 0x190604 #define APICTB 0x190604
#define APIJUNGFRAU 0x190604 #define APIEIGER 0x190712
#define APIGOTTHARD 0x190604 #define APIJUNGFRAU 0x190712
#define APIEIGER 0x190702 #define APIGOTTHARD 0x190712