Fixed ErormoveDriver to stop only on end switches when the target
exceeds the limits. Otherwise motors would get stuck on the switches when trying to move off them.
This commit is contained in:
@ -314,6 +314,7 @@ asynStatus EuroMoveAxis::move(double position, int relative, double minVelocity,
|
||||
sprintf(command,"G%d=%d", motNo, (int)position);
|
||||
status = pC_->transactController(motNo,command,reply);
|
||||
next_poll = -1;
|
||||
targetPosition = (int)position;
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -478,16 +479,28 @@ asynStatus EuroMoveAxis::poll(bool *moving)
|
||||
|
||||
/* Testing limit switches */
|
||||
if((axStatus & 2) > 0){ // bit 2
|
||||
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||
errlogPrintf("HighLimit detected on %d\n", motNo);
|
||||
sendStop();
|
||||
if(targetPosition > position) {
|
||||
/*
|
||||
Error codition only when we wish to move further
|
||||
*/
|
||||
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||
errlogPrintf("HighLimit detected on %d\n", motNo);
|
||||
updateMsgTxtFromDriver("On high limit switch");
|
||||
sendStop();
|
||||
}
|
||||
} else {
|
||||
setIntegerParam(pC_->motorStatusHighLimit_, false);
|
||||
}
|
||||
if((axStatus & 1) > 0){ // bit 1
|
||||
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||
errlogPrintf("LowLimit detected on %d\n", motNo);
|
||||
sendStop();
|
||||
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||
if(targetPosition < position) {
|
||||
/*
|
||||
Error treatment onlly when we want to go below the limits
|
||||
*/
|
||||
errlogPrintf("LowLimit detected on %d\n", motNo);
|
||||
sendStop();
|
||||
updateMsgTxtFromDriver("On low limit switch");
|
||||
}
|
||||
} else {
|
||||
setIntegerParam(pC_->motorStatusLowLimit_, false);
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
asynStatus sendStop();
|
||||
int resolution;
|
||||
friend class EuroMoveController;
|
||||
int targetPosition;
|
||||
};
|
||||
|
||||
class EuroMoveController : public SINQController {
|
||||
|
Reference in New Issue
Block a user