Set move flag correctly in velocity / jog mode
This commit is contained in:
@@ -272,7 +272,7 @@ asynStatus masterMacsAxis::init() {
|
|||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = setVeloFields(motVelocity, 0.0, motVmax);
|
status = setVeloFields(abs(motVelocity), 0.0, motVmax);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -535,6 +535,43 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
|||||||
return rwStatus;
|
return rwStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If moving in velocity mode, read out the current speed. Otherwise, read
|
||||||
|
// out the current position
|
||||||
|
if (pMasterMacsA_->lastMoveCommand == velocityMode && !speedEqualZero()) {
|
||||||
|
|
||||||
|
rwStatus = pC_->read(axisNo_, 14, response);
|
||||||
|
if (rwStatus != asynSuccess) {
|
||||||
|
return rwStatus;
|
||||||
|
}
|
||||||
|
nvals = sscanf(response, "%lf", &actualVelocity);
|
||||||
|
if (nvals != 1) {
|
||||||
|
return pC_->couldNotParseResponse("R14", response, axisNo_,
|
||||||
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the actual velocity to the paramLib
|
||||||
|
setAxisParamChecked(this, motorVelocity, actualVelocity);
|
||||||
|
|
||||||
|
// Motor is moving in velocity mode
|
||||||
|
*moving = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
rwStatus = pC_->read(axisNo_, 12, response);
|
||||||
|
if (rwStatus != asynSuccess) {
|
||||||
|
return rwStatus;
|
||||||
|
}
|
||||||
|
nvals = sscanf(response, "%lf", ¤tPosition);
|
||||||
|
if (nvals != 1) {
|
||||||
|
return pC_->couldNotParseResponse("R12", response, axisNo_,
|
||||||
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
plStatus = setMotorPosition(currentPosition);
|
||||||
|
if (plStatus != asynSuccess) {
|
||||||
|
return plStatus;
|
||||||
|
}
|
||||||
|
|
||||||
// If we wait for a handshake, but the motor was moving in its last poll
|
// If we wait for a handshake, but the motor was moving in its last poll
|
||||||
// cycle and has reached its target, it is not moving. Otherwise it is
|
// cycle and has reached its target, it is not moving. Otherwise it is
|
||||||
// considered moving, even if we're still waiting for the handshake.
|
// considered moving, even if we're still waiting for the handshake.
|
||||||
@@ -551,30 +588,6 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
|||||||
if (targetReached()) {
|
if (targetReached()) {
|
||||||
pMasterMacsA_->targetReachedUninitialized = false;
|
pMasterMacsA_->targetReachedUninitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If moving in velocity mode, read out the current speed. Otherwise, read
|
|
||||||
// out the current position
|
|
||||||
if (pMasterMacsA_->lastMoveCommand == velocityMode && *moving) {
|
|
||||||
rwStatus = pC_->read(axisNo_, 14, response);
|
|
||||||
if (rwStatus != asynSuccess) {
|
|
||||||
return rwStatus;
|
|
||||||
}
|
|
||||||
nvals = sscanf(response, "%lf", &actualVelocity);
|
|
||||||
if (nvals != 1) {
|
|
||||||
return pC_->couldNotParseResponse("R14", response, axisNo_,
|
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
rwStatus = pC_->read(axisNo_, 12, response);
|
|
||||||
if (rwStatus != asynSuccess) {
|
|
||||||
return rwStatus;
|
|
||||||
}
|
|
||||||
nvals = sscanf(response, "%lf", ¤tPosition);
|
|
||||||
if (nvals != 1) {
|
|
||||||
return pC_->couldNotParseResponse("R12", response, axisNo_,
|
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -789,14 +802,6 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
|||||||
setAxisParamChecked(this, motorStatusDone, !(*moving));
|
setAxisParamChecked(this, motorStatusDone, !(*moving));
|
||||||
setAxisParamChecked(this, motorStatusDirection, direction);
|
setAxisParamChecked(this, motorStatusDirection, direction);
|
||||||
|
|
||||||
plStatus = setMotorPosition(currentPosition);
|
|
||||||
if (plStatus != asynSuccess) {
|
|
||||||
return plStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the actual velocity to the paramLib
|
|
||||||
setAxisParamChecked(this, motorVelocity, actualVelocity);
|
|
||||||
|
|
||||||
return poll_status;
|
return poll_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,6 +1357,8 @@ bool masterMacsAxis::remoteMode() { return pMasterMacsA_->axisStatus[9]; }
|
|||||||
|
|
||||||
bool masterMacsAxis::targetReached() { return pMasterMacsA_->axisStatus[10]; }
|
bool masterMacsAxis::targetReached() { return pMasterMacsA_->axisStatus[10]; }
|
||||||
|
|
||||||
|
bool masterMacsAxis::speedEqualZero() { return pMasterMacsA_->axisStatus[12]; }
|
||||||
|
|
||||||
bool masterMacsAxis::internalLimitActive() {
|
bool masterMacsAxis::internalLimitActive() {
|
||||||
return pMasterMacsA_->axisStatus[11];
|
return pMasterMacsA_->axisStatus[11];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,6 +250,12 @@ class HIDDEN masterMacsAxis : public sinqAxis {
|
|||||||
*/
|
*/
|
||||||
bool internalLimitActive();
|
bool internalLimitActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
||||||
|
* redefinition in masterMacsAxis.cpp)
|
||||||
|
*/
|
||||||
|
bool speedEqualZero();
|
||||||
|
|
||||||
// Bits 12 and 13 are unused
|
// Bits 12 and 13 are unused
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user