Roll head back to 1.5.7
Test And Build / Lint (push) Successful in 5s
Test And Build / Build (push) Successful in 5s

This commit is contained in:
2026-02-10 08:10:56 +01:00
parent 4e30331c92
commit 2376e2adfd
6 changed files with 26 additions and 255 deletions
+12 -57
View File
@@ -245,10 +245,6 @@ asynStatus sinqAxis::forcedPoll(bool *moving) {
// Clear the communication
setAxisParamChecked(this, motorStatusCommsError, false);
// Assume the motor is initially connected. During the poll, this value will
// be set to false if the motor is not connected.
setAxisParamChecked(this, motorConnected, true);
/*
The poll function is just a wrapper around doPoll and handles mainly the
callParamCallbacks() function. This wrapper is used to make sure
@@ -256,11 +252,6 @@ asynStatus sinqAxis::forcedPoll(bool *moving) {
*/
poll_status = doPoll(moving);
// Motor is not connected
if (poll_status == asynDisconnected) {
setAxisParamChecked(this, motorConnected, false);
}
/*
If the poll did not succeed OR if an error message is waiting, something
went wrong and the motor has a status problem. Otherwise, delete the error
@@ -342,49 +333,18 @@ asynStatus sinqAxis::doPoll(bool *moving) {
return asynSuccess;
}
asynStatus sinqAxis::moveVelocity(double minVelocity, double maxVelocity,
double acceleration) {
int motMode = 0;
// If the motor is not in velocity mode, do nothing
getAxisParamChecked(this, motorMode, &motMode);
if (motMode != 0) {
return asynSuccess;
}
return doMoveVelocity(minVelocity, maxVelocity, acceleration);
}
asynStatus sinqAxis::doMoveVelocity(double minVelocity, double maxVelocity,
double acceleration) {
// Suppress unused variable warning - this is just a default fallback
// function.
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
return asynSuccess;
}
asynStatus sinqAxis::move(double position, int relative, double minVelocity,
double maxVelocity, double acceleration) {
// Status of parameter library operations
asynStatus status = asynSuccess;
double motRecRes = 0.0;
int motMode = 0;
double motorRecRes = 0.0;
// =========================================================================
// If the motor is not in position mode, do nothing
getAxisParamChecked(this, motorMode, &motMode);
if (motMode != 0) {
return asynSuccess;
}
// Store the target position internally
getAxisParamChecked(this, motorRecResolution, &motRecRes);
pSinqA_->targetPosition = position * motRecRes;
getAxisParamChecked(this, motorRecResolution, &motorRecRes);
pSinqA_->targetPosition = position * motorRecRes;
status = doMove(position, relative, minVelocity, maxVelocity, acceleration);
if (status != asynSuccess) {
@@ -495,9 +455,9 @@ asynStatus sinqAxis::enable(bool on) {
asynStatus sinqAxis::motorPosition(double *motorPos) {
asynStatus status = asynSuccess;
double motRecRes = 0.0;
double motorRecRes = 0.0;
getAxisParamChecked(this, motorRecResolution, &motRecRes);
getAxisParamChecked(this, motorRecResolution, &motorRecRes);
/*
We cannot use getAxisParamChecked checked here, since the name of the index
@@ -510,16 +470,16 @@ asynStatus sinqAxis::motorPosition(double *motorPos) {
__PRETTY_FUNCTION__, __LINE__);
}
*motorPos = *motorPos * motRecRes;
*motorPos = *motorPos * motorRecRes;
return status;
}
asynStatus sinqAxis::setMotorPosition(double motorPos) {
asynStatus status = asynSuccess;
double motRecRes = 0.0;
double motorRecRes = 0.0;
getAxisParamChecked(this, motorRecResolution, &motRecRes);
setAxisParamChecked(this, motorPosition, motorPos / motRecRes);
getAxisParamChecked(this, motorRecResolution, &motorRecRes);
setAxisParamChecked(this, motorPosition, motorPos / motorRecRes);
return status;
}
@@ -613,7 +573,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
double motorVelocityRec = 0.0;
double motorAccel = 0.0;
double motorAccelRec = 0.0;
double motRecRes = 0.0;
double motorRecRes = 0.0;
time_t timeContSpeed = 0;
time_t timeAccel = 0;
@@ -642,7 +602,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
= VELO / MRES motorAccel = (motorVelocity - motorVelBase) / ACCL
Therefore, we need to correct the values from the parameter library.
*/
getAxisParamChecked(this, motorRecResolution, &motRecRes);
getAxisParamChecked(this, motorRecResolution, &motorRecRes);
// Read the velocity
getAxisParamChecked(this, motorVelocity, &motorVelocityRec);
@@ -651,7 +611,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
// with a sensible value (e.g. > 0)
if (pl_status == asynSuccess && motorVelocityRec > 0.0) {
// Convert back to the value in the VELO field
motorVelocity = motorVelocityRec * motRecRes;
motorVelocity = motorVelocityRec * motorRecRes;
if (pl_status == asynSuccess) {
timeContSpeed =
@@ -741,11 +701,6 @@ void sinqAxis::setTargetPosition(double targetPosition) {
pSinqA_->targetPosition = targetPosition;
}
asynStatus sinqAxis::setMode(int mode) {
(void)mode;
return asynSuccess;
}
// =============================================================================
// IOC shell functions
extern "C" {
+6 -51
View File
@@ -107,46 +107,14 @@ class HIDDEN sinqAxis : public asynMotorAxis {
*/
virtual asynStatus doPoll(bool *moving);
/**
* @brief Perform some standardized operations before and after the concrete
`doMoveVelocity` implementation.
* Wrapper around `doMoveVelocity` which checks if the motor is in velocity
mode. If that is the case, it, it calls and returns `doMoveVelocity`.
Otherwise, it just returns `asynSuccess`.
*
* @param minVelocity Forwarded to `doMoveVelocity`.
* @param maxVelocity Forwarded to `doMoveVelocity`.
* @param acceleration Forwarded to `doMoveVelocity`.
* @return asynStatus Forward the status of `doMove`, unless one of
the parameter library operation fails (in that case, returns the failed
operation status).
*/
virtual asynStatus moveVelocity(double minVelocity, double maxVelocity,
double acceleration);
/**
* @brief Implementation of the "proper", device-specific move method. This
method should be implemented by a child class of sinqAxis.
*
* @param minVelocity Minimum velocity VBAS from the motor record
* @param maxVelocity Actual velocity VELO from the motor record
(yes, this is named badly. This is not VMAX!)
* @param acceleration Acceleration ACCEL from the motor record
* @return asynStatus
*/
virtual asynStatus doMoveVelocity(double minVelocity, double maxVelocity,
double acceleration);
/**
* @brief Perform some standardized operations before and after the concrete
`doMove` implementation.
* Wrapper around `doMove` which checks if the motor is in position
mode. If that is the case, the function calculates the (absolute) target
position and stores it in the member variable `targetPosition_`. This member
variable is e.g. used for the movement watchdog. Afterwards, it calls and
returns `doMove`. Otherwise, it just returns `asynSuccess`.
* Wrapper around `doMove` which calculates the (absolute) target position
and stores it in the member variable `targetPosition_`. This member variable
is e.g. used for the movement watchdog. Afterwards, it calls and returns
`doMove`.
*
* @param position Forwarded to `doMove`.
* @param relative Forwarded to `doMove`.
@@ -167,9 +135,8 @@ class HIDDEN sinqAxis : public asynMotorAxis {
* @param position Target position `VAL` from the motor record
* @param relative Specifies, whether the target position is
relative or absolute.
* @param minVelocity Minimum velocity VBAS from the motor record
* @param maxVelocity Actual velocity VELO from the motor record
(yes, this is named badly. This is not VMAX!)
* @param minVelocity Minimum velocity VMIN from the motor record
* @param maxVelocity Maximum velocity VMAX from the motor record
* @param acceleration Acceleration ACCEL from the motor record
* @return asynStatus
*/
@@ -434,18 +401,6 @@ class HIDDEN sinqAxis : public asynMotorAxis {
*/
asynStatus assertConnected();
/**
* @brief Set the operation mode (position or velocity) of the axis. It
* should be implemented by a child class of sinqAxis.
*
* This function is called from within sinqController::writeInt32 if a new
* operation mode has been set.
*
* @param mode: New operation mode. 0 is position mode, 1 is velocity mode.
* @return asynStatus
*/
virtual asynStatus setMode(int mode);
/**
* @brief Return a pointer to the axis controller.
*
-70
View File
@@ -100,9 +100,6 @@ struct sinqControllerImpl {
int motorHighLimitFromDriver;
int motorLowLimitFromDriver;
int motorPositionDeadband;
int motorMode;
int motorCanSetMode;
int motorSetMode;
int adaptivePolling;
int encoderType;
};
@@ -150,9 +147,6 @@ sinqController::sinqController(const char *portName,
.motorHighLimitFromDriver = 0,
.motorLowLimitFromDriver = 0,
.motorPositionDeadband = 0,
.motorMode = 0,
.motorCanSetMode = 0,
.motorSetMode = 0,
.adaptivePolling = 0,
.encoderType = 0,
})) {
@@ -396,38 +390,6 @@ sinqController::sinqController(const char *portName,
exit(-1);
}
status = createParam("MOTOR_MODE", asynParamInt32, &pSinqC_->motorMode);
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("MOTOR_CAN_SET_MODE", asynParamInt32,
&pSinqC_->motorCanSetMode);
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("MOTOR_SET_MODE", asynParamInt32, &pSinqC_->motorSetMode);
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);
}
// Register the hook function during construction of the first axis object
if (controller.empty()) {
initHookRegister(&epicsInithookFunction);
@@ -493,35 +455,6 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
return axis->reset();
} else if (function == motorForceStop()) {
return axis->stop(0.0);
} else if (function == motorSetMode()) {
// Check if it is allowed to set the mode
int canSetMode = 0;
getAxisParamChecked(axis, motorCanSetMode, &canSetMode);
if (canSetMode == 0) {
int axisNo;
getAddress(pasynUser, &axisNo);
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\ncannot "
"change operation mode of the motor",
portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
return asynError;
} else {
// Check if the given value is valid (i.e. 0 for position mode or 1
// for velocity mode):
if (value == 0 || value == 1) {
setAxisParamChecked(axis, motorMode, value);
return axis->setMode(value);
} else {
int axisNo;
getAddress(pasynUser, &axisNo);
asynPrint(
this->pasynUserSelf, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\n given motor "
"mode must be 0 (position mode) or 1 (velocity mode).",
portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
return asynError;
}
}
} else {
return asynMotorController::writeInt32(pasynUser, value);
}
@@ -809,9 +742,6 @@ int sinqController::motorLowLimitFromDriver() {
int sinqController::motorPositionDeadband() {
return pSinqC_->motorPositionDeadband;
}
int sinqController::motorMode() { return pSinqC_->motorMode; }
int sinqController::motorCanSetMode() { return pSinqC_->motorCanSetMode; }
int sinqController::motorSetMode() { return pSinqC_->motorSetMode; }
int sinqController::adaptivePolling() { return pSinqC_->adaptivePolling; }
int sinqController::encoderType() { return pSinqC_->encoderType; }
+2 -6
View File
@@ -76,8 +76,7 @@ class HIDDEN sinqController : public asynMotorController {
/**
* @brief Overloaded function of asynMotorController
*
* The function is overloaded to allow enabling / disabling the motor and
* setting the operation mode of the motor.
* The function is overloaded to allow enabling / disabling the motor.
*
* @param pasynUser Specify the axis via the asynUser
* @param value New value
@@ -314,7 +313,7 @@ class HIDDEN sinqController : public asynMotorController {
int motorRecOffset() { return motorRecOffset_; }
// Accessors for additional PVs defined in sinqController (which are hidden
// behind pSinqC_)
// in pSinqC_)
int motorMessageText();
int motorReset();
int motorEnable();
@@ -332,9 +331,6 @@ class HIDDEN sinqController : public asynMotorController {
int motorHighLimitFromDriver();
int motorLowLimitFromDriver();
int motorPositionDeadband();
int motorMode();
int motorCanSetMode();
int motorSetMode();
int adaptivePolling();
int encoderType();