Added Connected PV

This commit is contained in:
2025-04-25 13:17:41 +02:00
parent 3ec83b115e
commit c7936191d9
5 changed files with 41 additions and 1 deletions

View File

@ -54,6 +54,18 @@ record(calc, "$(INSTR)$(M):StatusProblem")
field(CALC, "A >> 9") field(CALC, "A >> 9")
} }
# If the value of this PV is 0, the according axis is currently disconnected from the controller.
# Trying to give commands to a disconnected axis will result in an error message in the IOC shell
# This record is coupled to the parameter library via motorConnected_ -> MOTOR_CONNECTED.
record(longin, "$(INSTR)$(M):Connected")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(CONTROLLER),$(AXIS)) MOTOR_CONNECTED")
field(SCAN, "I/O Intr")
field(PINI, "NO")
field(INIT, "1")
}
# Call the reset function of the corresponding sinqAxis # Call the reset function of the corresponding sinqAxis
# This record is coupled to the parameter library via motorReset_ -> MOTOR_RESET. # This record is coupled to the parameter library via motorReset_ -> MOTOR_RESET.
record(longout, "$(INSTR)$(M):Reset") { record(longout, "$(INSTR)$(M):Reset") {

View File

@ -67,6 +67,18 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
exit(-1); exit(-1);
} }
// Assume that the motor is connected initially
status = setIntegerParam(pC_->motorConnected(), 1);
if (status != asynSuccess) {
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
"(setting a parameter value failed "
"with %s)\n. Terminating IOC",
pC->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
pC_->stringifyAsynStatus(status));
exit(-1);
}
// We assume that the motor has no status problems initially // We assume that the motor has no status problems initially
status = setIntegerParam(pC_->motorStatusProblem(), 0); status = setIntegerParam(pC_->motorStatusProblem(), 0);
if (status != asynSuccess) { if (status != asynSuccess) {
@ -113,6 +125,7 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
} }
asynStatus sinqAxis::poll(bool *moving) { asynStatus sinqAxis::poll(bool *moving) {
// Local variable declaration // Local variable declaration
asynStatus pl_status = asynSuccess; asynStatus pl_status = asynSuccess;
asynStatus poll_status = asynSuccess; asynStatus poll_status = asynSuccess;

View File

@ -357,7 +357,7 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
bool watchdogMovActive_; bool watchdogMovActive_;
// Store the motor target position for the movement time calculation // Store the motor target position for the movement time calculation
double targetPosition_; double targetPosition_;
bool wasMoving_; bool wasMoving_;
/* /*

View File

@ -170,6 +170,16 @@ sinqController::sinqController(const char *portName,
exit(-1); exit(-1);
} }
status = createParam("MOTOR_CONNECTED", asynParamInt32, &motorConnected_);
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);
}
/* /*
We need to introduce 2 new parameters in order to write the limits from the We need to introduce 2 new parameters in order to write the limits from the
driver to the EPICS record. See the comment in sinqController.h next to driver to the EPICS record. See the comment in sinqController.h next to

View File

@ -285,6 +285,7 @@ class epicsShareClass sinqController : public asynMotorController {
int motorCanSetSpeed() { return motorCanSetSpeed_; } int motorCanSetSpeed() { return motorCanSetSpeed_; }
int motorLimitsOffset() { return motorLimitsOffset_; } int motorLimitsOffset() { return motorLimitsOffset_; }
int motorForceStop() { return motorForceStop_; } int motorForceStop() { return motorForceStop_; }
int motorConnected() { return motorConnected_; }
int motorVeloFromDriver() { return motorVeloFromDriver_; } int motorVeloFromDriver() { return motorVeloFromDriver_; }
int motorVbasFromDriver() { return motorVbasFromDriver_; } int motorVbasFromDriver() { return motorVbasFromDriver_; }
int motorVmaxFromDriver() { return motorVmaxFromDriver_; } int motorVmaxFromDriver() { return motorVmaxFromDriver_; }
@ -335,6 +336,9 @@ class epicsShareClass sinqController : public asynMotorController {
int maxSubsequentTimeouts_; int maxSubsequentTimeouts_;
bool maxSubsequentTimeoutsExceeded_; bool maxSubsequentTimeoutsExceeded_;
/*
See the documentation in db/sinqMotor.db for the following integers
*/
#define FIRST_SINQMOTOR_PARAM motorMessageText_ #define FIRST_SINQMOTOR_PARAM motorMessageText_
int motorMessageText_; int motorMessageText_;
int motorReset_; int motorReset_;
@ -345,6 +349,7 @@ class epicsShareClass sinqController : public asynMotorController {
int motorCanSetSpeed_; int motorCanSetSpeed_;
int motorLimitsOffset_; int motorLimitsOffset_;
int motorForceStop_; int motorForceStop_;
int motorConnected_;
/* /*
These parameters are here to write values from the hardware to the EPICS These parameters are here to write values from the hardware to the EPICS
motor record. Using motorHighLimit_ / motorLowLimit_ does not work: motor record. Using motorHighLimit_ / motorLowLimit_ does not work: