Merge pull request #31 from dls-controls/fix/temperature-control
Temperature parameter is set on startup to current temperature. Inval…
This commit is contained in:
@@ -241,6 +241,13 @@ AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraSeri
|
||||
checkStatus(GetFastestRecommendedVSSpeed(&mVSIndex, &mVSPeriod));
|
||||
mCapabilities.ulSize = sizeof(mCapabilities);
|
||||
checkStatus(GetCapabilities(&mCapabilities));
|
||||
|
||||
/* Get current temperature */
|
||||
float temperature;
|
||||
checkStatus(GetTemperatureF(&temperature));
|
||||
printf("%s:%s: current temperature is %f\n", driverName, functionName, temperature);
|
||||
setDoubleParam(ADTemperature, temperature);
|
||||
|
||||
callParamCallbacks();
|
||||
} catch (const std::string &e) {
|
||||
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
@@ -771,6 +778,10 @@ asynStatus AndorCCD::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
|
||||
int minTemp = 0;
|
||||
int maxTemp = 0;
|
||||
|
||||
/* Store the old value */
|
||||
epicsFloat64 oldValue;
|
||||
getDoubleParam(function, &oldValue);
|
||||
|
||||
/* Set the parameter and readback in the parameter library. */
|
||||
status = setDoubleParam(function, value);
|
||||
|
||||
@@ -791,16 +802,21 @@ asynStatus AndorCCD::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
|
||||
"%s:%s:, Setting temperature value %f\n",
|
||||
driverName, functionName, value);
|
||||
try {
|
||||
/* Check requested temperature is within our range */
|
||||
checkStatus(GetTemperatureRange(&minTemp, &maxTemp));
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
|
||||
"%s:%s:, CCD Min Temp: %d, Max Temp %d\n",
|
||||
driverName, functionName, minTemp, maxTemp);
|
||||
checkStatus(GetTemperatureRange(&minTemp, &maxTemp));
|
||||
if ((static_cast<int>(value) > minTemp) & (static_cast<int>(value) < maxTemp)) {
|
||||
if ((static_cast<int>(value) >= minTemp) & (static_cast<int>(value) <= maxTemp)) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
|
||||
"%s:%s:, SetTemperature(%d)\n",
|
||||
driverName, functionName, static_cast<int>(value));
|
||||
checkStatus(SetTemperature(static_cast<int>(value)));
|
||||
} else {
|
||||
/* Requested temperature is out of range */
|
||||
status = setDoubleParam(function, oldValue);
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
|
||||
"Requested temperature out of range\n");
|
||||
setStringParam(AndorMessage, "Temperature is out of range.");
|
||||
callParamCallbacks();
|
||||
status = asynError;
|
||||
@@ -816,24 +832,24 @@ asynStatus AndorCCD::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
|
||||
(function == ADShutterCloseDelay)) {
|
||||
status = setupShutter(-1);
|
||||
}
|
||||
|
||||
else {
|
||||
status = ADDriver::writeFloat64(pasynUser, value);
|
||||
}
|
||||
|
||||
//For a successful write, clear the error message.
|
||||
setStringParam(AndorMessage, " ");
|
||||
|
||||
/* Do callbacks so higher layers see any changes */
|
||||
callParamCallbacks();
|
||||
if (status)
|
||||
if (status) {
|
||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||
"%s:%s: error, status=%d function=%d, value=%f\n",
|
||||
driverName, functionName, status, function, value);
|
||||
else
|
||||
}
|
||||
else {
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: function=%d, value=%f\n",
|
||||
driverName, functionName, function, value);
|
||||
/* For a successful write, clear the error message. */
|
||||
setStringParam(AndorMessage, " ");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1484,7 +1500,7 @@ void AndorCCD::dataTask(void)
|
||||
epicsTimeStamp startTime;
|
||||
NDArray *pArray;
|
||||
int autoSave;
|
||||
int readOutMode;
|
||||
int readOutMode;
|
||||
static const char *functionName = "dataTask";
|
||||
|
||||
printf("%s:%s: Data thread started...\n", driverName, functionName);
|
||||
@@ -1584,8 +1600,8 @@ void AndorCCD::dataTask(void)
|
||||
dims[0] = sizeX;
|
||||
dims[1] = sizeY;
|
||||
pArray = this->pNDArrayPool->alloc(nDims, dims, dataType, 0, NULL);
|
||||
if (readOutMode == ARRandomTrack)
|
||||
mMultiTrack.storeTrackAttributes(pArray->pAttributeList);
|
||||
if (readOutMode == ARRandomTrack)
|
||||
mMultiTrack.storeTrackAttributes(pArray->pAttributeList);
|
||||
// Read the oldest array
|
||||
// Is there still an image available?
|
||||
status = GetNumberNewImages(&firstImage, &lastImage);
|
||||
|
||||
Reference in New Issue
Block a user