Fixed some small bugs

This commit is contained in:
2025-10-13 16:57:30 +02:00
parent a70bcc0d75
commit 6d00209e8a
2 changed files with 20 additions and 23 deletions

View File

@@ -143,7 +143,6 @@ asynStatus turboPmacAxis::init() {
// Offset time for the movement watchdog caused by the air cushions in // Offset time for the movement watchdog caused by the air cushions in
// milliseconds. // milliseconds.
int acoDelay = 0.0; int acoDelay = 0.0;
int axStatus = 0;
// The parameter library takes some time to be initialized. Therefore we // The parameter library takes some time to be initialized. Therefore we
// wait until the status is not asynParamUndefined anymore. // wait until the status is not asynParamUndefined anymore.
@@ -177,8 +176,7 @@ asynStatus turboPmacAxis::init() {
Ixx65. Ixx65.
*/ */
snprintf(command, sizeof(command), snprintf(command, sizeof(command),
"P%2.2d00 Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 " "Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d65",
"I%2.2d65",
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_,
axisNo_); axisNo_);
status = pC_->writeRead(axisNo_, command, response, 8); status = pC_->writeRead(axisNo_, command, response, 8);
@@ -193,9 +191,9 @@ asynStatus turboPmacAxis::init() {
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__); pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__);
pTurboPmacA_->needInit = true; pTurboPmacA_->needInit = true;
} }
nvals = sscanf(response, "%d %lf %lf %lf %lf %d %lf %lf", &axStatus, nvals = sscanf(response, "%lf %lf %lf %lf %d %lf %lf", &motorPos,
&motorPos, &motorVmax, &motorVelocity, &motorAccel, &motorVmax, &motorVelocity, &motorAccel, &acoDelay,
&acoDelay, &counts_to_eu, &deadband_counts); &counts_to_eu, &deadband_counts);
// The acoDelay is given in milliseconds -> Convert to seconds, rounded up // The acoDelay is given in milliseconds -> Convert to seconds, rounded up
setOffsetMovTimeout(std::ceil(acoDelay / 1000.0)); setOffsetMovTimeout(std::ceil(acoDelay / 1000.0));
@@ -555,11 +553,6 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
errorStatus = handleError(error, userMessage, sizeof(userMessage)); errorStatus = handleError(error, userMessage, sizeof(userMessage));
// Update the parameter library
if (error != 0) {
setAxisParamChecked(this, motorStatusProblem, true);
}
if (*moving == false) { if (*moving == false) {
setAxisParamChecked(this, motorMoveToHome, false); setAxisParamChecked(this, motorMoveToHome, false);
} }

View File

@@ -13,6 +13,10 @@ class HIDDEN turboPmacAxis : public sinqAxis {
* *
* @param pController Pointer to the associated controller * @param pController Pointer to the associated controller
* @param axisNo Index of the axis * @param axisNo Index of the axis
* @param initialize By setting this parameter to false, the
* initialization functions of the axes are not executed. This is e.g.
* necessary when this constructor is called from a children class
* constructor which performs its own initialization.
*/ */
turboPmacAxis(turboPmacController *pController, int axisNo, turboPmacAxis(turboPmacController *pController, int axisNo,
bool initialize = true); bool initialize = true);
@@ -24,6 +28,18 @@ class HIDDEN turboPmacAxis : public sinqAxis {
*/ */
virtual ~turboPmacAxis(); virtual ~turboPmacAxis();
/**
* @brief Readout of some values from the controller at IOC startup
*
* The following steps are performed:
* - Read out the motor status, motor position, velocity and acceleration
* from the MCU and store this information in the parameter library.
* - Set the enable PV according to the initial status of the axis.
*
* @return asynStatus
*/
virtual asynStatus init();
/** /**
* @brief Implementation of the `stop` function from asynMotorAxis * @brief Implementation of the `stop` function from asynMotorAxis
* *
@@ -70,18 +86,6 @@ class HIDDEN turboPmacAxis : public sinqAxis {
double min_velocity, double max_velocity, double min_velocity, double max_velocity,
double acceleration); double acceleration);
/**
* @brief Readout of some values from the controller at IOC startup
*
* The following steps are performed:
* - Read out the motor status, motor position, velocity and acceleration
* from the MCU and store this information in the parameter library.
* - Set the enable PV according to the initial status of the axis.
*
* @return asynStatus
*/
virtual asynStatus init();
/** /**
* @brief Implementation of the `doReset` function from sinqAxis. * @brief Implementation of the `doReset` function from sinqAxis.
* *