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,20 +100,13 @@ asynStatus sinqAxis::poll(bool *moving) {
} }
} }
// The poll function is just a wrapper around doPoll and /*
// handles mainly the callParamCallbacks() function. This wrapper is used At the beginning of the poll, it is assumed that the axis has no status
// to make sure callParamCallbacks() is called in case of a premature problems and therefore all error indicators are reset. This does not affect
// return. the PVs until callParamCallbacks has been called!
poll_status = doPoll(moving);
// Check and update the watchdog The motorStatusProblem_ field changes the motor record fields SEVR and STAT.
if (checkMovTimeoutWatchdog(*moving) != asynSuccess) { */
return asynError;
}
// If the poll status is ok, reset the error indicators in the parameter
// library
if (poll_status == asynSuccess) {
pl_status = setIntegerParam(pC_->motorStatusProblem_, false); pl_status = setIntegerParam(pC_->motorStatusProblem_, false);
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
@ -124,12 +117,31 @@ asynStatus sinqAxis::poll(bool *moving) {
pC_->paramLibAccessFailed(pl_status, "motorStatusCommsError_", pC_->paramLibAccessFailed(pl_status, "motorStatusCommsError_",
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
pl_status = setStringParam(pC_->motorMessageText_, ""); pl_status = setStringParam(pC_->motorMessageText_, "");
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
// The poll function is just a wrapper around doPoll and
// handles mainly the callParamCallbacks() function. This wrapper is used
// to make sure callParamCallbacks() is called in case of a premature
// return.
poll_status = doPoll(moving);
// The poll did not succeed: Something went wrong and the motor has a status
// problem.
if (poll_status != asynSuccess) {
pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
if (pl_status != asynSuccess) {
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
__PRETTY_FUNCTION__, __LINE__);
}
}
// Check and update the watchdog
if (checkMovTimeoutWatchdog(*moving) != asynSuccess) {
return asynError;
} }
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: