diff --git a/src/detectorTowerAngleAxis.cpp b/src/detectorTowerAngleAxis.cpp index 594e0cb..9ed8407 100644 --- a/src/detectorTowerAngleAxis.cpp +++ b/src/detectorTowerAngleAxis.cpp @@ -260,9 +260,8 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() { } if (isInChangerPos) { - plStatus = setStringParam( - pC_->motorMessageText(), - "Move the axis to working state first."); + plStatus = setStringParam(pC_->motorMessageText(), + "Move the axis to working state first."); if (plStatus != asynSuccess) { return pC_->paramLibAccessFailed(plStatus, "motorMessageText", axisNo_, __PRETTY_FUNCTION__, @@ -449,9 +448,6 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) { axisNo_, __PRETTY_FUNCTION__, __LINE__); } - - return pC_->paramLibAccessFailed(plStatus, "motorMessageText_", axisNo_, - __PRETTY_FUNCTION__, __LINE__); } plStatus = setIntegerParam(pC_->changeStateRBV(), toChangingPosition); diff --git a/src/detectorTowerController.cpp b/src/detectorTowerController.cpp index 3fc0929..5dc089e 100644 --- a/src/detectorTowerController.cpp +++ b/src/detectorTowerController.cpp @@ -272,9 +272,9 @@ asynStatus detectorTowerController::pollDetectorAxes( // Status of parameter library operations asynStatus plStatus = asynSuccess; - char userMessage[MAXBUF_] = {0}; -// User message which was created in one of the other axis methods - char oldUserMessage[MAXBUF_] = {0}; + char errorMessage[MAXBUF_] = {0}; + // User message which was created in one of the other axis methods + char waitingErrorMessage[MAXBUF_] = {0}; char response[MAXBUF_] = {0}; int nvals = 0; @@ -482,9 +482,8 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetCountPosState = false; - snprintf(userMessage, sizeof(userMessage), - "Reset one of the tower axes." - ); + snprintf(errorMessage, sizeof(errorMessage), + "Reset one of the tower axes."); pollStatus = asynError; break; @@ -520,7 +519,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetCountPosState = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Unknown state P358 = %d has been reached. Please call " "the support.", positionState); @@ -567,7 +566,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Brake COZ not released. Try resetting the axis."); pollStatus = asynError; @@ -584,7 +583,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Move command rejected because axis is already moving. Try " "resetting the axis."); @@ -601,7 +600,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Error in motor FTZ. Try resetting the axis."); pollStatus = asynError; @@ -618,9 +617,9 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), - "Axis stopped unexpectedly. Try resetting the axis " - "and issue the move command again."); + snprintf(errorMessage, sizeof(errorMessage), + "Axis stopped unexpectedly. Try resetting the axis and issue " + "the move command again."); pollStatus = asynError; break; @@ -637,7 +636,7 @@ asynStatus detectorTowerController::pollDetectorAxes( resetError = false; snprintf( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Axis release was removed while moving. Try resetting the axis " "and issue the move command again."); @@ -655,7 +654,8 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), "Emergency stop activated."); + snprintf(errorMessage, sizeof(errorMessage), + "Emergency stop activated."); pollStatus = asynError; break; @@ -670,7 +670,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Error in motor COZ. Try resetting the axis."); pollStatus = asynError; @@ -686,7 +686,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Error in motor COM. Try resetting the axis."); pollStatus = asynError; @@ -702,7 +702,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Error in motor COX. Try resetting the axis."); pollStatus = asynError; @@ -719,7 +719,7 @@ asynStatus detectorTowerController::pollDetectorAxes( resetError = false; snprintf( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Hit end switch FTZ. Try moving the axis in the other direction."); pollStatus = asynError; @@ -737,7 +737,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Maximum allowed following error exceeded (P359 = %d). " "Check if movement range is blocked.", error); @@ -756,7 +756,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Minimum allowed angle exceeded (P359 = %d). Try moving the " "axis in the other direction.", error); @@ -775,7 +775,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), + snprintf(errorMessage, sizeof(errorMessage), "Maximum allowed angle exceeded (P359 = %d). Try moving the " "axis in the other direction.", error); @@ -794,7 +794,7 @@ asynStatus detectorTowerController::pollDetectorAxes( } resetError = false; - snprintf(userMessage, sizeof(userMessage), "Unknown error P359 = %d.", + snprintf(errorMessage, sizeof(errorMessage), "Unknown error P359 = %d.", error); pollStatus = asynError; @@ -805,13 +805,14 @@ asynStatus detectorTowerController::pollDetectorAxes( getMsgPrintControl().resetCount(keyError, pasynUser()); } - // Update the parameter library for all axes + /* + Does the paramLib already contain an error message? If either this is the + case or if error != 0, report a status problem for all axes. + */ + getStringParam(angleAxisNo, motorMessageText(), sizeof(waitingErrorMessage), + waitingErrorMessage); - - -getStringParam(angleAxisNo, motorMessageText(), sizeof(oldUserMessage), oldUserMessage); - - if (error != 0 || oldUserMessage[0] != '\0') { + if (error != 0 || waitingErrorMessage[0] != '\0') { plStatus = angleAxis->setIntegerParam(motorStatusProblem(), true); if (plStatus != asynSuccess) { @@ -835,25 +836,29 @@ getStringParam(angleAxisNo, motorMessageText(), sizeof(oldUserMessage), oldUserM } } - // Update the user message text, if one is available -if (userMessage[0] != '\0') { - plStatus = angleAxis->setStringParam(motorMessageText(), userMessage); - if (plStatus != asynSuccess) { - return paramLibAccessFailed(plStatus, "motorMessageText_", angleAxisNo, - __PRETTY_FUNCTION__, __LINE__); + // Update the error message text with the one created in this poll (in case + // it is not empty). + if (errorMessage[0] != '\0') { + plStatus = angleAxis->setStringParam(motorMessageText(), errorMessage); + if (plStatus != asynSuccess) { + return paramLibAccessFailed(plStatus, "motorMessageText_", + angleAxisNo, __PRETTY_FUNCTION__, + __LINE__); + } + plStatus = liftAxis->setStringParam(motorMessageText(), errorMessage); + if (plStatus != asynSuccess) { + return paramLibAccessFailed(plStatus, "motorMessageText_", + liftAxisNo, __PRETTY_FUNCTION__, + __LINE__); + } + plStatus = + supportAxis->setStringParam(motorMessageText(), errorMessage); + if (plStatus != asynSuccess) { + return paramLibAccessFailed(plStatus, "motorMessageText_", + supportAxisNo, __PRETTY_FUNCTION__, + __LINE__); + } } - plStatus = liftAxis->setStringParam(motorMessageText(), userMessage); - if (plStatus != asynSuccess) { - return paramLibAccessFailed(plStatus, "motorMessageText_", liftAxisNo, - __PRETTY_FUNCTION__, __LINE__); - } - plStatus = supportAxis->setStringParam(motorMessageText(), userMessage); - if (plStatus != asynSuccess) { - return paramLibAccessFailed(plStatus, "motorMessageText_", - supportAxisNo, __PRETTY_FUNCTION__, - __LINE__); - } -} // Update the working position state PV plStatus = angleAxis->setIntegerParam(positionStateRBV(), positionState); @@ -1122,7 +1127,12 @@ if (userMessage[0] != '\0') { pollStatus = plStatus; } - // Reset the message text for the next poll cycle AFTER updating the PVs + /* + Reset the message text for the next poll cycle AFTER updating the PVs. + This makes sure that non-persistent error messages are shown for at least + one poll cycle, but are cleared afterwards. Persisting error messages will + be recreated during each poll. + */ plStatus = angleAxis->setStringParam(motorMessageText(), ""); if (plStatus != asynSuccess) { return paramLibAccessFailed(plStatus, "motorMessageText_", angleAxisNo,