Skip to content
Open
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
25 changes: 25 additions & 0 deletions merlinApp/Db/merlin.template
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,31 @@ record(ai, "$(P)$(R)OperatingEnergy_RBV")
field(SCAN, "I/O Intr")
}

# Board Temperature
# % autosave 2
## gdatag, pv, rw, $(PORT)_merlin, BoardTemperature, Set BoardTemperature
# record(ao, "$(P)$(R)BoardTemperature")
# {
# field(PINI, "YES")
# field(DTYP, "asynFloat64")
# field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))BOARDTEMPERATURE")
# field(DESC, "Board Temperature")
# field(EGU, "C")
# field(PREC, "3")
# field(VAL, "20.000")
# }

## gdatag, pv, ro, $(PORT)_merlin, BoardTemperature_RBV, Readback for BoardTemperature
record(ai, "$(P)$(R)BoardTemperature_RBV")
{
field(DTYP, "asynFloat64")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))TEMPERATURE")
field(DESC, "Board Temperature")
field(EGU, "C")
field(PREC, "3")
field(SCAN, "I/O Intr")
}


# Threshold Scan Start Energy
# % autosave 2
Expand Down
28 changes: 28 additions & 0 deletions merlinApp/src/merlinDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,25 @@ asynStatus merlinDetector::updateThresholdScanParms()
return status;
}

asynStatus merlinDetector::getBoardTemperature()
{
int status;

if (startingUp)
return asynSuccess;

status = cmdConnection->mpxGet(MPXVAR_TEMPERATURE,
Labview_DEFAULT_TIMEOUT);
if (status == asynSuccess)
setDoubleParam(merlinBoardTemperature,
atof(cmdConnection->fromLabviewValue));

callParamCallbacks();

return (asynSuccess);
}


static void merlinTaskC(void *drvPvt)
{
merlinDetector *pPvt = (merlinDetector *) drvPvt;
Expand Down Expand Up @@ -931,6 +950,7 @@ void merlinDetector::merlinStatus()
setROI();
updateThresholdScanParms();
getThreshold();
getBoardTemperature();

result = cmdConnection->mpxGet(MPXVAR_GETSOFTWAREVERSION,
Labview_DEFAULT_TIMEOUT);
Expand All @@ -944,11 +964,17 @@ void merlinDetector::merlinStatus()
while (1)
{
epicsThreadSleep(4);

this->lock();
getIntegerParam(ADStatus, &status);

if (status == ADStatusIdle)
{
status = cmdConnection->mpxGet(MPXVAR_TEMPERATURE,
Labview_DEFAULT_TIMEOUT);
if (status == asynSuccess)
setDoubleParam(merlinBoardTemperature, atof(cmdConnection->fromLabviewValue));

setStringParam(ADStatusMessage, "Waiting for acquire command");
callParamCallbacks();
}
Expand Down Expand Up @@ -1417,6 +1443,8 @@ merlinDetector::merlinDetector(const char *portName,
createParam(merlinThreshold7String, asynParamFloat64, &merlinThreshold7);
createParam(merlinOperatingEnergyString, asynParamFloat64,
&merlinOperatingEnergy);
createParam(merlinBoardTemperatureString, asynParamFloat64,
&merlinBoardTemperature);
createParam(merlinThresholdApplyString, asynParamInt32,
&merlinThresholdApply);
createParam(merlinThresholdAutoApplyString, asynParamInt32,
Expand Down
3 changes: 3 additions & 0 deletions merlinApp/src/merlinDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ typedef enum
#define merlinThreshold6String "THRESHOLD6"
#define merlinThreshold7String "THRESHOLD7"
#define merlinOperatingEnergyString "OPERATINGENERGY"
#define merlinBoardTemperatureString "TEMPERATURE"

#define merlinThresholdApplyString "THRESHOLD_APPLY"
#define merlinThresholdAutoApplyString "THRESHOLD_AUTO_APPLY"
Expand Down Expand Up @@ -142,6 +143,7 @@ class merlinDetector: public ADDriver
int merlinThreshold6;
int merlinThreshold7;
int merlinOperatingEnergy;
int merlinBoardTemperature;
int merlinThresholdApply;
int merlinThresholdAutoApply;
int merlinArmed;
Expand Down Expand Up @@ -174,6 +176,7 @@ class merlinDetector: public ADDriver
asynStatus getThreshold();
asynStatus updateThresholdScanParms();
asynStatus setROI();
asynStatus getBoardTemperature();

NDArray* copyProfileToNDArray32(size_t *dims, char *buffer,
int profileMask);
Expand Down
5 changes: 5 additions & 0 deletions merlinApp/src/merlin_low.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ extern int mpxDisconnect(void);
#define MPXVAR_COLOURMODE (char*) "COLOURMODE"
#define MPXVAR_CHARGESUMMING (char*) "CHARGESUMMING"


// variables - Status
#define MPXVAR_TEMPERATURE (char*) "TEMPERATURE"


// variables Threshold Scan Control
#define MPXVAR_THSSCAN (char*) "THSCAN"
#define MPXVAR_THWINDOWMODE (char*) "THWINDOWMODE"
Expand Down