Fixed wrong limits after power cycle
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Successful in 7s

This commit is contained in:
2026-06-09 15:14:06 +02:00
parent b476b2a499
commit 1440fafc7d
+16 -3
View File
@@ -793,9 +793,22 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
}
}
// Update the enable PV
setAxisParamChecked(this, motorEnableRBV,
readyToBeSwitchedOn() && switchedOn());
/*
If the motor just got enabled, we need to initialize it, because some
parameters like the limits on the motor controllers are lost during a power
cycle and are rewritten from the masterMacs "meta-controller" when enabling.
*/
int wasEnabled = 0;
int isEnabled = readyToBeSwitchedOn() && switchedOn();
getAxisParamChecked(this, motorEnableRBV, &wasEnabled);
if (isEnabled && !wasEnabled) {
rwStatus = init();
if (rwStatus != asynSuccess) {
return rwStatus;
}
}
setAxisParamChecked(this, motorEnableRBV, isEnabled);
if (*moving) {
// If the axis is moving, evaluate the movement direction