WIP version with offset RBV (integration from hardware currently
missing)
This commit is contained in:
@@ -27,105 +27,6 @@ detectorTowerController::detectorTowerController(
|
||||
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
// =========================================================================
|
||||
// Create additional parameter library entries
|
||||
|
||||
status = createParam("LIFT_OFFSET", asynParamFloat64, &liftOffset_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status =
|
||||
createParam("LIFT_OFFSET_MOVE", asynParamFloat64, &liftOffsetMove_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("LIFT_OFFSET_LOW_LIMIT", asynParamFloat64,
|
||||
&liftOffsetLowLimit_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("LIFT_OFFSET_HIGH_LIMIT", asynParamFloat64,
|
||||
&liftOffsetHighLimit_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("TILT_OFFSET", asynParamFloat64, &tiltOffset_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status =
|
||||
createParam("TILT_OFFSET_MOVE", asynParamFloat64, &tiltOffsetMove_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("TILT_OFFSET_LOW_LIMIT", asynParamFloat64,
|
||||
&tiltOffsetLowLimit_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("TILT_OFFSET_HIGH_LIMIT", asynParamFloat64,
|
||||
&tiltOffsetHighLimit_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("BEAM_ANGLE", asynParamFloat64, &beamAngle_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("POSITION_STATE", asynParamInt32, &positionState_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
@@ -136,16 +37,6 @@ detectorTowerController::detectorTowerController(
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("START", asynParamInt32, &start_);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("MOVE_TO_WORKING_POSITION", asynParamInt32,
|
||||
&moveToWorkingPosition_);
|
||||
if (status != asynSuccess) {
|
||||
@@ -174,7 +65,7 @@ asynStatus detectorTowerController::readInt32(asynUser *pasynUser,
|
||||
// Check if the axis is a detectorTowerAxis
|
||||
detectorTowerAxis *axis = getDetectorTowerAxis(pasynUser);
|
||||
if (axis == nullptr) {
|
||||
// This is apparently a "normal" turboPmacAxis
|
||||
// This is apparently a "normal" turboPmacAxis or an offsetAxis
|
||||
return turboPmacController::readInt32(pasynUser, value);
|
||||
} else {
|
||||
// The detector tower cannot be disabled
|
||||
@@ -196,31 +87,10 @@ asynStatus detectorTowerController::writeInt32(asynUser *pasynUser,
|
||||
detectorTowerAxis *axis = getDetectorTowerAxis(pasynUser);
|
||||
|
||||
if (axis == nullptr) {
|
||||
// This is apparently a "normal" turboPmacAxis
|
||||
// This is apparently a "normal" turboPmacAxis or an offsetAxis
|
||||
return turboPmacController::writeInt32(pasynUser, value);
|
||||
} else {
|
||||
// Handle custom PVs
|
||||
if (function == start_) {
|
||||
|
||||
// Start the movement, if the axis is not already moving.
|
||||
// Otherwise stop it and schedule a movement.
|
||||
int done = 0;
|
||||
asynStatus status =
|
||||
getIntegerParam(axis->axisNo_, motorStatusDone_, &done);
|
||||
if (status != asynSuccess) {
|
||||
return paramLibAccessFailed(status, "motorStatusDone_",
|
||||
axis->axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
if (done == 1) {
|
||||
return axis->moveFromParamLib();
|
||||
} else {
|
||||
axis->scheduleMoveFromParamLib_ = true;
|
||||
return axis->stop(0.0);
|
||||
}
|
||||
|
||||
} else if (function == moveToWorkingPosition_) {
|
||||
if (function == moveToWorkingPosition_) {
|
||||
return axis->moveToWorkingPosition(value != 0);
|
||||
} else if (function == resetError_) {
|
||||
return axis->reset();
|
||||
@@ -230,40 +100,6 @@ asynStatus detectorTowerController::writeInt32(asynUser *pasynUser,
|
||||
}
|
||||
}
|
||||
|
||||
asynStatus detectorTowerController::writeFloat64(asynUser *pasynUser,
|
||||
epicsFloat64 value) {
|
||||
int function = pasynUser->reason;
|
||||
|
||||
detectorTowerAxis *axis = getDetectorTowerAxis(pasynUser);
|
||||
|
||||
if (axis == nullptr) {
|
||||
// This is apparently a "normal" turboPmacAxis
|
||||
return turboPmacController::writeFloat64(pasynUser, value);
|
||||
} else {
|
||||
if (function == liftOffsetMove_) {
|
||||
asynStatus status =
|
||||
setDoubleParam(axis->axisNo_, liftOffset_, value);
|
||||
if (status != asynSuccess) {
|
||||
return paramLibAccessFailed(status, "liftOffset_",
|
||||
axis->axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
return axis->moveFromParamLib();
|
||||
} else if (function == tiltOffsetMove_) {
|
||||
asynStatus status =
|
||||
setDoubleParam(axis->axisNo_, tiltOffset_, value);
|
||||
if (status != asynSuccess) {
|
||||
return paramLibAccessFailed(status, "tiltOffset_",
|
||||
axis->axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
return axis->moveFromParamLib();
|
||||
} else {
|
||||
return turboPmacController::writeFloat64(pasynUser, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Access one of the axes of the controller via the axis adress stored in asynUser.
|
||||
If the axis does not exist or is not a Axis, a nullptr is returned and an
|
||||
|
||||
Reference in New Issue
Block a user