diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d1a233731..8617c8206 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -193,6 +193,7 @@ void qDrawPlot::SetupPlots() { gainplot2d = new SlsQt2DPlot(boxPlot, true); gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData); + gainplot2d->Update(); gainplot2d->hide(); connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this, SLOT(Zoom2DGainPlot(const QRectF &))); @@ -1009,6 +1010,7 @@ void qDrawPlot::Update2dPlot() { if (isGainDataExtracted) { gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData); + gainplot2d->Update(); if (!gainplot2d->isVisible()) { gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO); diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index fbe333f97..e7401f474 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -3323,6 +3323,27 @@ void *start_timer(void *arg) { break; } + // change gain and data for every frame + { + const int nchannels = NCHIP * NCHAN; + int gainVal = 0; + for (int i = 0; i < nchannels; ++i) { + if ((i % nchannels) < 400) { + gainVal = 1 + frameNr; + } else if ((i % nchannels) < 800) { + gainVal = 2 + frameNr; + } else { + gainVal = 3 + frameNr; + } + int dataVal = + *((uint16_t *)(imageData + i * sizeof(uint16_t))); + dataVal += frameNr; + int channelVal = + (dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST); + *((uint16_t *)(imageData + i * sizeof(uint16_t))) = + (uint16_t)channelVal; + } + } // sleep for exposure time struct timespec begin, end; clock_gettime(CLOCK_REALTIME, &begin); diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 73379083d..0060ce55a 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -2726,6 +2726,7 @@ void *start_timer(void *arg) { if (i % pixelsPerPacket == 0) { ++dataVal; } + if ((i % 1024) < 300) { gainVal = 1; } else if ((i % 1024) < 600) { @@ -2766,6 +2767,28 @@ void *start_timer(void *arg) { clock_gettime(CLOCK_REALTIME, &begin); usleep(expUs); + // change gain and data for every frame + { + const int npixels = (NCHAN * NCHIP); + for (int i = 0; i < npixels; ++i) { + int gainVal = 0; + if ((i % 1024) < 300) { + gainVal = 1 + iframes; + } else if ((i % 1024) < 600) { + gainVal = 2 + iframes; + } else { + gainVal = 3 + iframes; + } + int dataVal = + *((uint16_t *)(imageData + i * sizeof(uint16_t))); + dataVal += iframes; + int pixelVal = + (dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST); + *((uint16_t *)(imageData + i * sizeof(uint16_t))) = + (uint16_t)pixelVal; + } + } + int srcOffset = 0; int srcOffset2 = DATA_BYTES / 2; int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);