diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index f8c8c20..9fd04ea 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -176,7 +176,7 @@ asynStatus turboPmacAxis::init() { Ixx65. */ snprintf(command, sizeof(command), - "Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d65", + "Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d28", axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_); status = pC_->writeRead(axisNo_, command, response, 7); @@ -290,7 +290,7 @@ asynStatus turboPmacAxis::init() { asynStatus turboPmacAxis::doPoll(bool *moving) { // Return value for the poll - asynStatus errorStatus = asynSuccess; + asynStatus pollStatus = asynSuccess; // Status of read-write-operations of ASCII commands to the controller asynStatus status = asynSuccess; @@ -426,8 +426,9 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { // Update the enablement PV, if we are not in the middle of a enabling / // disabling procedure. if (!(pTurboPmacA_->enableDisable)) { - setAxisParamChecked(this, motorEnableRBV, - (axStatus != -3 && axStatus != -5)); + setAxisParamChecked( + this, motorEnableRBV, + (axStatus != -3 && axStatus != -4 && axStatus != -5)); } // Create the unique callsite identifier manually so it can be used @@ -445,6 +446,9 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { case -5: // Axis is deactivated *moving = false; + setAxisParamChecked(this, motorErrorMessage, + "Deactivated. Please call the support."); + pollStatus = asynError; break; case -4: // Emergency stop @@ -453,14 +457,16 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { if (pC_->getMsgPrintControl().shouldBePrinted(keyStatus, true, pC_->pasynUser())) { asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, - "Controller \"%s\", axis %d => %s, line " - "%d\nEmergency stop " - "activated.%s\n", + "Controller \"%s\", axis %d => %s, line %d\nEmergency " + "stop activated.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->getMsgPrintControl().getSuffix()); } resetCountStatus = false; - setAxisParamChecked(this, motorErrorMessage, "Emergency stop"); + setAxisParamChecked( + this, motorErrorMessage, + "Emergency stop. Reset SPS or check emergency stop buttons."); + pollStatus = asynError; break; case -3: // Disabled @@ -569,7 +575,11 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { } } - errorStatus = handleError(error, userMessage, sizeof(userMessage)); + asynStatus errorStatus = + handleError(error, userMessage, sizeof(userMessage)); + if (errorStatus != asynSuccess) { + pollStatus = errorStatus; + } if (*moving == false) { setAxisParamChecked(this, motorMoveToHome, false); @@ -593,7 +603,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { if (status != asynSuccess) { return status; } - return errorStatus; + return pollStatus; } asynStatus turboPmacAxis::handleError(int error, char *userMessage, @@ -618,7 +628,7 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage, pC_->getMsgPrintControl().getSuffix()); } setAxisParamChecked(this, motorErrorMessage, - "Target position would exceed software limits"); + "Target position would exceed software limits."); break; case 5: // Command not possible @@ -633,9 +643,9 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->getMsgPrintControl().getSuffix()); } - setAxisParamChecked(this, motorErrorMessage, - "Axis received move command while it is still " - "moving. Please call the support."); + setAxisParamChecked( + this, motorErrorMessage, + "Axis received move command while it is not ready."); break; case 8: if (pC_->getMsgPrintControl().shouldBePrinted( diff --git a/src/turboPmacController.cpp b/src/turboPmacController.cpp index ced38fa..f922197 100644 --- a/src/turboPmacController.cpp +++ b/src/turboPmacController.cpp @@ -346,18 +346,18 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, snprintf(reasonStringified, sizeof(reasonStringified), "Request count reached"); break; - case 2: - snprintf(reasonStringified, sizeof(reasonStringified), - "End of string detected"); - break; case 3: snprintf(reasonStringified, sizeof(reasonStringified), "End indicator detected"); break; + default: + snprintf(reasonStringified, sizeof(reasonStringified), + "Unknown eomReason %d", eomReason); + break; } snprintf(drvMessageText, sizeof(drvMessageText), - "Terminated message due to reason %s (should be \"End of " + "Terminated message due to \"%s\" (should be \"End of " "string detected\"). Please call the support.", reasonStringified); @@ -410,22 +410,22 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, } // Create custom error messages for different failure modes, if no error - // message has been set yet + // message has been set yet. if (strlen(drvMessageText) == 0) { switch (status) { case asynSuccess: break; // Communicate nothing case asynTimeout: snprintf(drvMessageText, sizeof(drvMessageText), - "connection timeout for axis %d", axisNo); + "Connection timeout for axis %d", axisNo); break; case asynDisconnected: snprintf(drvMessageText, sizeof(drvMessageText), - "axis is not connected"); + "Axis is not connected"); break; case asynDisabled: snprintf(drvMessageText, sizeof(drvMessageText), - "axis is disabled"); + "Axis is disabled"); break; default: snprintf(drvMessageText, sizeof(drvMessageText), @@ -438,13 +438,16 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, if (status == asynSuccess) { setAxisParamChecked(axis, motorStatusCommsError, false); } else { - // Check if the axis already is in an error communication mode. If - // it is not, upstream the error. This is done to avoid "flooding" - // the user with different error messages if more than one error - // ocurred before an error-free communication + // Check if the axis already is in an error communication mode (motor + // has status problem and an error message already exists). If either + // one of these conditions are not fulfilled, upstream the error. This + // is done to avoid "flooding" the user with different error messages if + // more than one error ocurred before an error-free communication + char oldMsg[MAXBUF_] = {0}; + getAxisParamChecked(axis, motorErrorMessage, oldMsg); getAxisParamChecked(axis, motorStatusProblem, &motorStatusProblem); - if (motorStatusProblem == 0) { + if (motorStatusProblem == 0 || oldMsg[0] == 0) { setAxisParamChecked(axis, motorErrorMessage, drvMessageText); setAxisParamChecked(axis, motorStatusProblem, true); setAxisParamChecked(axis, motorStatusCommsError, true);