Compare commits

..

2 Commits
0.5.0 ... 0.6.0

3 changed files with 46 additions and 32 deletions

View File

@ -1,18 +1,18 @@
# The main asyn motor record. Some fields are populated from the substitution # The main asyn motor record. Some fields are populated from the substitution
# files via macros: # files via macros:
# - $(INSTR): Name of the instrument, e.g. "SQ:SINQTEST:" # - INSTR: Name of the instrument, e.g. "SQ:SINQTEST:"
# - $(M): Name of the motor in EPICS, e.g. "lin1" # - M: Name of the motor in EPICS, e.g. "lin1"
# - $(DESC): Short description of the motor # - DESC: Short description of the motor. If not given, this is equal to M
# - $(DIR): This value is usually set to "Pos". If the motor axis direction # - DIR: This value is usually set to "Pos". If the motor axis direction
# should be inverted, this value can be set to "Neg" # should be inverted, this value can be set to "Neg"
# - $(CONTROLLER): Name of the motor controller, e.g. "mcu1" # - CONTROLLER: Name of the motor controller, e.g. "mcu1"
# - $(AXIS): Number of the axis, e.g. "1" # - AXIS: Number of the axis, e.g. "1"
# - $(MRES): Motor record resolution. See the README.md for a detailed discussion # - MRES: Motor record resolution. See the README.md for a detailed discussion
# - $(EGU): Engineering units. In case of a rotary axis, this is "degree", in # - EGU: Engineering units. In case of a rotary axis, this is "degree", in
# case of a linear axis this is "mm". # case of a linear axis this is "mm".
record(motor,"$(INSTR)$(M)") record(motor,"$(INSTR)$(M)")
{ {
field(DESC,"$(DESC)") field(DESC,"$(DESC=$(M))")
field(DTYP,"asynMotor") field(DTYP,"asynMotor")
field(DIR,"$(DIR=Pos)") field(DIR,"$(DIR=Pos)")
field(OUT,"@asyn($(CONTROLLER),$(AXIS))") field(OUT,"@asyn($(CONTROLLER),$(AXIS))")

View File

@ -100,36 +100,48 @@ asynStatus sinqAxis::poll(bool *moving) {
} }
} }
/*
At the beginning of the poll, it is assumed that the axis has no status
problems and therefore all error indicators are reset. This does not affect
the PVs until callParamCallbacks has been called!
The motorStatusProblem_ field changes the motor record fields SEVR and STAT.
*/
pl_status = setIntegerParam(pC_->motorStatusProblem_, false);
if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
__PRETTY_FUNCTION__, __LINE__);
}
pl_status = setIntegerParam(pC_->motorStatusCommsError_, false);
if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusCommsError_",
__PRETTY_FUNCTION__, __LINE__);
}
pl_status = setStringParam(pC_->motorMessageText_, "");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
__PRETTY_FUNCTION__, __LINE__);
}
// The poll function is just a wrapper around doPoll and // The poll function is just a wrapper around doPoll and
// handles mainly the callParamCallbacks() function. This wrapper is used // handles mainly the callParamCallbacks() function. This wrapper is used
// to make sure callParamCallbacks() is called in case of a premature // to make sure callParamCallbacks() is called in case of a premature
// return. // return.
poll_status = doPoll(moving); poll_status = doPoll(moving);
// Check and update the watchdog // The poll did not succeed: Something went wrong and the motor has a status
if (checkMovTimeoutWatchdog(*moving) != asynSuccess) { // problem.
return asynError; if (poll_status != asynSuccess) {
} pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
// If the poll status is ok, reset the error indicators in the parameter
// library
if (poll_status == asynSuccess) {
pl_status = setIntegerParam(pC_->motorStatusProblem_, false);
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
pl_status = setIntegerParam(pC_->motorStatusCommsError_, false); }
if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusCommsError_",
__PRETTY_FUNCTION__, __LINE__);
}
pl_status = setStringParam(pC_->motorMessageText_, ""); // Check and update the watchdog
if (pl_status != asynSuccess) { if (checkMovTimeoutWatchdog(*moving) != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", return asynError;
__PRETTY_FUNCTION__, __LINE__);
}
} }
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
@ -490,8 +502,9 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
// Check the watchdog // Check the watchdog
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
"%s => line %d:\nAxis %d exceeded the expected arrival time " "%s => line %d:\nAxis %d exceeded the expected arrival time "
"(%ld).\n", "%ld (current time is %ld).\n",
__PRETTY_FUNCTION__, __LINE__, axisNo_, expectedArrivalTime_); __PRETTY_FUNCTION__, __LINE__, axisNo_, expectedArrivalTime_,
time(NULL));
pl_status = setStringParam( pl_status = setStringParam(
pC_->motorMessageText_, pC_->motorMessageText_,

View File

@ -10,8 +10,9 @@ Stefan Mathis, November 2024
#define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER" #define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER"
#define motorMessageTextString "MOTOR_MESSAGE_TEXT" #define motorMessageTextString "MOTOR_MESSAGE_TEXT"
#define IncrementalEncoder "Incremental encoder" #define IncrementalEncoder "incremental"
#define AbsoluteEncoder "Absolute encoder" #define AbsoluteEncoder "absolute"
#define NoEncoder "none"
class epicsShareClass sinqController : public asynMotorController { class epicsShareClass sinqController : public asynMotorController {
public: public: