Added safe limit setter
Test And Build / Lint (push) Successful in 6s
Test And Build / Build (push) Successful in 5s

This commit is contained in:
2026-02-10 08:48:25 +01:00
parent 82f509596d
commit 95bc899114
2 changed files with 39 additions and 0 deletions
+25
View File
@@ -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);