diff --git a/Makefile b/Makefile index e93cf38..4bbf8c3 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,8 @@ ARCH_FILTER=RHEL% # Specify the version of asynMotor we want to build against motorBase_VERSION=7.2.2 +LIBVERSION=homeerror + # These headers allow to depend on this library for derived drivers. HEADERS += src/masterMacsAxis.h HEADERS += src/masterMacsController.h diff --git a/src/masterMacsAxis.cpp b/src/masterMacsAxis.cpp index 254040e..67d7cd0 100644 --- a/src/masterMacsAxis.cpp +++ b/src/masterMacsAxis.cpp @@ -629,42 +629,51 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { } /* - Either the software limits or the end switches of the controller - have been hit. Since the EPICS limits are derived from the software - limits and are a little bit smaller, these error cases can only - happen if either the axis has an incremental encoder which is not - properly homed or if a bug occured. - */ - if (positiveLimitSwitch() || negativeLimitSwitch() || - positiveSoftwareLimit() || negativeSoftwareLimit()) { + If the motor is homing or has been homed, ignore limit switch errors. + */ + int homing = 0; + int homed = 0; + getAxisParamChecked(this, motorStatusHome, &homing); + getAxisParamChecked(this, motorStatusHomed, &homed); + if (homing || homed) { + /* + Either the software limits or the end switches of the controller + have been hit. Since the EPICS limits are derived from the software + limits and are a little bit smaller, these error cases can only + happen if either the axis has an incremental encoder which is not + properly homed or if a bug occured. + */ + if (positiveLimitSwitch() || negativeLimitSwitch() || + positiveSoftwareLimit() || negativeSoftwareLimit()) { - // Distinction for developers - if (positiveLimitSwitch()) { - appendErrorMessage(shellMessage, sizeof(shellMessage), - "Positive limit switch."); - } - if (negativeLimitSwitch()) { - appendErrorMessage(shellMessage, sizeof(shellMessage), - "Negative limit switch."); - } - if (positiveSoftwareLimit()) { - appendErrorMessage(shellMessage, sizeof(shellMessage), - "Positive software limit."); - } - if (negativeSoftwareLimit()) { - appendErrorMessage(shellMessage, sizeof(shellMessage), - "Negative software limit."); - } + // Distinction for developers + if (positiveLimitSwitch()) { + appendErrorMessage(shellMessage, sizeof(shellMessage), + "Positive limit switch."); + } + if (negativeLimitSwitch()) { + appendErrorMessage(shellMessage, sizeof(shellMessage), + "Negative limit switch."); + } + if (positiveSoftwareLimit()) { + appendErrorMessage(shellMessage, sizeof(shellMessage), + "Positive software limit."); + } + if (negativeSoftwareLimit()) { + appendErrorMessage(shellMessage, sizeof(shellMessage), + "Negative software limit."); + } - // Generic error message for user - appendErrorMessage( - errorMessage, sizeof(errorMessage), - "Software limits or end switch hit. Try homing the motor, " - "moving in the opposite direction or check the SPS for " - "errors (if available). Otherwise please call the " - "support."); + // Generic error message for user + appendErrorMessage( + errorMessage, sizeof(errorMessage), + "Software limits or end switch hit. Try homing the motor, " + "moving in the opposite direction or check the SPS for " + "errors (if available). Otherwise please call the " + "support."); - poll_status = asynError; + poll_status = asynError; + } } if (overCurrent()) {