Added safe limit setter
This commit is contained in:
@@ -493,6 +493,31 @@ asynStatus sinqAxis::setMotorPosition(double motorPos) {
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::setLimits(double highLimit, double lowLimit) {
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
if (highLimit < lowLimit) {
|
||||
double motorPos;
|
||||
double motorRecRes;
|
||||
status = motorPosition(&motorPos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecRes);
|
||||
|
||||
// This is a safe fallback
|
||||
setAxisParamChecked(this, motorHighLimitFromDriver,
|
||||
motorPos + motorRecRes);
|
||||
setAxisParamChecked(this, motorLowLimitFromDriver,
|
||||
motorPos - motorRecRes);
|
||||
} else {
|
||||
setAxisParamChecked(this, motorHighLimitFromDriver, highLimit);
|
||||
setAxisParamChecked(this, motorLowLimitFromDriver, lowLimit);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::assertConnected() {
|
||||
int connected = 0;
|
||||
getAxisParamChecked(this, motorConnected, &connected);
|
||||
|
||||
Reference in New Issue
Block a user