Updated sinqMotor to 1.5.5

This commit is contained in:
2025-09-17 12:34:47 +02:00
parent de32298609
commit ebcf99ac56
3 changed files with 31 additions and 17 deletions

View File

@@ -85,7 +85,14 @@ void appendErrorMessage(char *fullMessage, size_t capacityFullMessage,
} }
masterMacsAxis::masterMacsAxis(masterMacsController *pC, int axisNo) masterMacsAxis::masterMacsAxis(masterMacsController *pC, int axisNo)
: sinqAxis(pC, axisNo), pC_(pC) { : sinqAxis(pC, axisNo), pC_(pC),
pMasterMacsA_(std::make_unique<masterMacsAxisImpl>((masterMacsAxisImpl){
.axisStatus = std::bitset<16>(0),
.axisError = std::bitset<16>(0),
.waitForHandshake = false,
.timeAtHandshake = 0,
.targetReachedUninitialized = true,
})) {
asynStatus status = asynSuccess; asynStatus status = asynSuccess;
@@ -118,14 +125,6 @@ masterMacsAxis::masterMacsAxis(masterMacsController *pC, int axisNo)
// Collect all axes into this list which will be used in the hook function // Collect all axes into this list which will be used in the hook function
axes.push_back(this); axes.push_back(this);
pMasterMacsA_ = std::make_unique<masterMacsAxisImpl>((masterMacsAxisImpl){
.axisStatus = std::bitset<16>(0),
.axisError = std::bitset<16>(0),
.waitForHandshake = false,
.timeAtHandshake = 0,
.targetReachedUninitialized = true,
});
// masterMacs motors can always be disabled // masterMacs motors can always be disabled
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 1); status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 1);
if (status != asynSuccess) { if (status != asynSuccess) {
@@ -688,6 +687,11 @@ asynStatus masterMacsAxis::doMove(double position, int relative,
double minVelocity, double maxVelocity, double minVelocity, double maxVelocity,
double acceleration) { double acceleration) {
// Suppress unused variable warning
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
// Status of read-write-operations of ASCII commands to the controller // Status of read-write-operations of ASCII commands to the controller
asynStatus status = asynSuccess; asynStatus status = asynSuccess;
@@ -790,6 +794,9 @@ asynStatus masterMacsAxis::doMove(double position, int relative,
asynStatus masterMacsAxis::stop(double acceleration) { asynStatus masterMacsAxis::stop(double acceleration) {
// Suppress unused variable warning
(void)acceleration;
asynStatus status = pC_->write(axisNo_, 00, "8"); asynStatus status = pC_->write(axisNo_, 00, "8");
if (status != asynSuccess) { if (status != asynSuccess) {
setAxisParamChecked(this, motorStatusProblem, true); setAxisParamChecked(this, motorStatusProblem, true);
@@ -845,13 +852,19 @@ asynStatus masterMacsAxis::nodeReset() {
/* /*
Home the axis. On absolute encoder systems, this is a no-op Home the axis. On absolute encoder systems, this is a no-op
*/ */
asynStatus masterMacsAxis::doHome(double min_velocity, double max_velocity, asynStatus masterMacsAxis::doHome(double minVelocity, double maxVelocity,
double acceleration, int forwards) { double acceleration, int forwards) {
char response[pC_->MAXBUF_] = {0}; char response[pC_->MAXBUF_] = {0};
// ========================================================================= // =========================================================================
// Suppress unused variable warning
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
(void)forwards;
getAxisParamChecked(this, encoderType, &response); getAxisParamChecked(this, encoderType, &response);
// Only send the home command if the axis has an incremental encoder // Only send the home command if the axis has an incremental encoder
@@ -1246,8 +1259,9 @@ static const iocshArg CreateAxisArg0 = {"Controller name (e.g. mmacs1)",
static const iocshArg CreateAxisArg1 = {"Axis number", iocshArgInt}; static const iocshArg CreateAxisArg1 = {"Axis number", iocshArgInt};
static const iocshArg *const CreateAxisArgs[] = {&CreateAxisArg0, static const iocshArg *const CreateAxisArgs[] = {&CreateAxisArg0,
&CreateAxisArg1}; &CreateAxisArg1};
static const iocshFuncDef configMasterMacsCreateAxis = {"masterMacsAxis", 2, static const iocshFuncDef configMasterMacsCreateAxis = {
CreateAxisArgs}; "masterMacsAxis", 2, CreateAxisArgs,
"Create a new instance of a MasterMACS axis."};
static void configMasterMacsCreateAxisCallFunc(const iocshArgBuf *args) { static void configMasterMacsCreateAxisCallFunc(const iocshArgBuf *args) {
masterMacsCreateAxis(args[0].sval, args[1].ival); masterMacsCreateAxis(args[0].sval, args[1].ival);
} }

View File

@@ -57,13 +57,13 @@ class HIDDEN masterMacsAxis : public sinqAxis {
* *
* @param position * @param position
* @param relative * @param relative
* @param min_velocity * @param minVelocity
* @param max_velocity * @param maxVelocity
* @param acceleration * @param acceleration
* @return asynStatus * @return asynStatus
*/ */
asynStatus doMove(double position, int relative, double min_velocity, asynStatus doMove(double position, int relative, double minVelocity,
double max_velocity, double acceleration); double maxVelocity, double acceleration);
/** /**
* @brief Implementation of the `stop` function from asynMotorAxis * @brief Implementation of the `stop` function from asynMotorAxis