Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions eigerApp/Db/eigerBase.template
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ record(bi,"$(P)$(R)SignedData_RBV") {
record(longin, "$(P)$(R)BitDepthImage_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))EIG_DCI_bit_depth_image")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))BIT_DEPTH_IMG")
field(DESC, "Image Bit Depth")
field(SCAN, "I/O Intr")
}
Expand Down Expand Up @@ -1175,10 +1175,6 @@ record(mbbo, "$(P)$(R)DataType")
{
field(DISA, "1")
}
record(mbbi, "$(P)$(R)DataType_RBV")
{
field(DISA, "1")
}
record(mbbo, "$(P)$(R)ColorMode")
{
field(DISA, "1")
Expand Down
40 changes: 32 additions & 8 deletions eigerApp/src/eigerDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ eigerDetector::eigerDetector (const char *portName, const char *serverHostname,
mCompressionAlgo = mParams.create(EigCompressionAlgoStr, asynParamInt32, SSDetConfig, "compression");
mROIMode = mParams.create(EigROIModeStr, asynParamInt32, SSDetConfig, "roi_mode");
mAutoSummation = mParams.create(EigAutoSummationStr, asynParamInt32, SSDetConfig, "auto_summation");
mBitDepthImage = mParams.create(EigBitDepthImageStr, asynParamInt32, SSDetConfig, "bit_depth_image");

// Detector Status Parameters
mError = mParams.create(EigErrorStr, asynParamOctet, SSDetStatus, "error");
Expand Down Expand Up @@ -592,17 +593,15 @@ asynStatus eigerDetector::writeInt32 (asynUser *pasynUser, epicsInt32 value)
ERR_ARGS("error status=%d function=%d, value=%d", status, function, value);
return status;
}
else {
// Any setting change may cause the detector to change bit_depth_image
updateNDDataType();
callParamCallbacks();

callParamCallbacks();

if (status)
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s: error, status=%d function=%d, value=%d\n",
driverName, functionName, status, function, value);
else
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s: function=%d, value=%d\n",
driverName, functionName, function, value);
}

return status;
}
Expand Down Expand Up @@ -679,6 +678,9 @@ asynStatus eigerDetector::writeFloat64 (asynUser *pasynUser, epicsFloat64 value)
"%s:%s: function=%d, value=%f\n",
driverName, functionName, function, value);

// Any setting change may cause the detector to change bit_depth_image
updateNDDataType();

callParamCallbacks();
}
return status;
Expand Down Expand Up @@ -1618,6 +1620,28 @@ void eigerDetector::restartTask()
}
}

asynStatus eigerDetector::updateNDDataType (void)
{
const char *functionName = "updateNDDataType";
int bitDepth = 0, signedData = 0;

mBitDepthImage->fetch(bitDepth);
mSignedData->get(signedData);

NDDataType_t ndType;
switch(bitDepth)
{
case 8: ndType = signedData ? NDInt8 : NDUInt8; break;
case 16: ndType = signedData ? NDInt16 : NDUInt16; break;
case 32: ndType = signedData ? NDInt32 : NDUInt32; break;
default:
ERR_ARGS("unexpected bit_depth_image=%d", bitDepth);
return asynError;
}

return setIntegerParam(NDDataType, ndType);
}

asynStatus eigerDetector::initParams (void)
{
int status = asynSuccess;
Expand Down Expand Up @@ -1653,7 +1677,7 @@ asynStatus eigerDetector::initParams (void)

// Set some default values
status |= setIntegerParam(NDArraySize, 0);
status |= setIntegerParam(NDDataType, NDUInt32);
status |= updateNDDataType();
status |= setIntegerParam(ADImageMode, ADImageMultiple);

mArmed->put(false);
Expand Down
5 changes: 5 additions & 0 deletions eigerApp/src/eigerDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef enum {
// Acquisition Metadata Parameters
#define EigWavelengthStr "WAVELENGTH"
#define EigAutoSummationStr "AUTO_SUMMATION"
#define EigBitDepthImageStr "BIT_DEPTH_IMG"

// Detector Metadata Parameters
#define EigDescriptionStr "DESCRIPTION"
Expand Down Expand Up @@ -204,6 +205,7 @@ class eigerDetector : public ADDriver
EigerParam *mCompressionAlgo;
EigerParam *mROIMode;
EigerParam *mAutoSummation;
EigerParam *mBitDepthImage;

//Pilatus4 parameters
EigerParam *mThreshold3;
Expand Down Expand Up @@ -284,6 +286,9 @@ class eigerDetector : public ADDriver
// Read all parameters from detector and set some default values
asynStatus initParams (void);

// Sets NDDataType from the detector's bit_depth_image and the SignedData setting
asynStatus updateNDDataType (void);

// File parsers
asynStatus parseH5File (char *buf, size_t len);
asynStatus parseTiffFile (char *buf, size_t len);
Expand Down