Added stop and error reset function for masterMacs

This commit is contained in:
2025-03-19 15:06:45 +01:00
parent 631ee46a50
commit 16564011a6
4 changed files with 47 additions and 14 deletions

View File

@ -13,7 +13,7 @@ REQUIRED+=sinqMotor
motorBase_VERSION=7.2.2
# Specify the version of sinqMotor we want to build against
sinqMotor_VERSION=mathis_s
sinqMotor_VERSION=0.9.0
# These headers allow to depend on this library for derived drivers.
HEADERS += src/masterMacsAxis.h

View File

@ -593,7 +593,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
keyError, true, pC_->asynUserSelf())) {
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line "
"%d\n%s.%s\n",
"%d\n%s%s\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__,
__LINE__, shellMessage,
pC_->getMsgPrintControl().getSuffix());
@ -894,6 +894,28 @@ asynStatus masterMacsAxis::stop(double acceleration) {
return rw_status;
}
asynStatus masterMacsAxis::reset() {
// Status of read-write-operations of ASCII commands to the controller
asynStatus rw_status = asynSuccess;
// Status of parameter library operations
asynStatus pl_status = asynSuccess;
// =========================================================================
rw_status = pC_->write(axisNo_, 17, "");
if (rw_status != asynSuccess) {
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
}
return rw_status;
}
/*
Home the axis. On absolute encoder systems, this is a no-op
*/

View File

@ -24,15 +24,6 @@ class masterMacsAxis : public sinqAxis {
*/
virtual ~masterMacsAxis();
/**
* @brief Implementation of the `stop` function from asynMotorAxis
*
* @param acceleration Acceleration ACCEL from the motor record. This
* value is currently not used.
* @return asynStatus
*/
asynStatus stop(double acceleration);
/**
* @brief Implementation of the `doHome` function from sinqAxis. The
* parameters are described in the documentation of `sinqAxis::doHome`.
@ -69,6 +60,23 @@ class masterMacsAxis : public sinqAxis {
asynStatus doMove(double position, int relative, double min_velocity,
double max_velocity, double acceleration);
/**
* @brief Implementation of the `stop` function from asynMotorAxis
*
* @param acceleration Acceleration ACCEL from the motor record. This
* value is currently not used.
* @return asynStatus
*/
asynStatus stop(double acceleration);
/**
* @brief Reset the axis error
*
* @param on
* @return asynStatus
*/
asynStatus reset();
/**
* @brief Readout of some values from the controller at IOC startup
*

View File

@ -162,12 +162,15 @@ asynStatus masterMacsController::writeRead(int axisNo, int tcpCmd,
return asynError;
}
// TODO: CR at the end
if (isRead) {
snprintf(fullCommand, MAXBUF_ - 1, "%dR%02d\x0D", axisNo, tcpCmd);
} else {
snprintf(fullCommand, MAXBUF_ - 1, "%dS%02d=%s\x0D", axisNo, tcpCmd,
payload);
if (strlen(payload) == 0) {
snprintf(fullCommand, MAXBUF_ - 1, "%dS%02d\x0D", axisNo, tcpCmd);
} else {
snprintf(fullCommand, MAXBUF_ - 1, "%dS%02d=%s\x0D", axisNo, tcpCmd,
payload);
}
}
// Calculate the command length