diff --git a/Makefile b/Makefile index 93806e6..342e7cf 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,4 @@ SOURCES += src/masterMacsController.cpp # This file registers the motor-specific functions in the IOC shell. DBDS += src/masterMacs.dbd -USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wpedantic -Wextra -Werror +USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wextra -Werror diff --git a/src/masterMacsAxis.cpp b/src/masterMacsAxis.cpp index 0545958..ab0d1e8 100644 --- a/src/masterMacsAxis.cpp +++ b/src/masterMacsAxis.cpp @@ -460,7 +460,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { // This buffer must be initialized to zero because we build the // error message by appending strings. - char userMessage[pC_->MAXBUF_] = {0}; + char errorMessage[pC_->MAXBUF_] = {0}; char shellMessage[pC_->MAXBUF_] = {0}; // Concatenate all other errors @@ -468,7 +468,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Short circuit fault."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Short circuit error. Please call the support."); poll_status = asynError; @@ -477,7 +477,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { if (encoderError()) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Encoder error."); - appendErrorMessage(userMessage, sizeof(userMessage), + appendErrorMessage(errorMessage, sizeof(errorMessage), "Encoder error. Please call the support."); poll_status = asynError; @@ -488,7 +488,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { shellMessage, sizeof(shellMessage), "Maximum callowed following error exceeded."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Maximum allowed following error exceeded.Check if " "movement range is blocked. Otherwise please call the " "support."); @@ -499,7 +499,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { if (feedbackError()) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Feedback error."); - appendErrorMessage(userMessage, sizeof(userMessage), + appendErrorMessage(errorMessage, sizeof(errorMessage), "Feedback error. Please call the support."); poll_status = asynError; @@ -535,7 +535,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { // Generic error message for user appendErrorMessage( - userMessage, sizeof(userMessage), + 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 " @@ -548,7 +548,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Overcurrent error."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Overcurrent error. Please call the support."); poll_status = asynError; @@ -558,7 +558,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Overtemperature error."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Overtemperature error. Please call the support."); poll_status = asynError; @@ -568,7 +568,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Overvoltage error."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Overvoltage error. Please call the support."); poll_status = asynError; @@ -578,7 +578,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { appendErrorMessage(shellMessage, sizeof(shellMessage), "Undervoltage error."); appendErrorMessage( - userMessage, sizeof(userMessage), + errorMessage, sizeof(errorMessage), "Undervoltage error. Please call the support."); poll_status = asynError; @@ -587,7 +587,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { if (stoFault()) { appendErrorMessage(shellMessage, sizeof(shellMessage), "STO input is on disable state."); - appendErrorMessage(userMessage, sizeof(userMessage), + appendErrorMessage(errorMessage, sizeof(errorMessage), "STO fault. Please call the support."); poll_status = asynError; @@ -605,7 +605,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { } } - pl_status = setStringParam(pC_->motorMessageText(), userMessage); + pl_status = setStringParam(pC_->motorMessageText(), errorMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -1093,16 +1093,6 @@ asynStatus masterMacsAxis::enable(bool on) { "Controller \"%s\", axis %d => %s, line %d:\n%s axis.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, on ? "Enable" : "Disable"); - if (on == 0) { - pl_status = setStringParam(pC_->motorMessageText(), "Disabling ..."); - } else { - pl_status = setStringParam(pC_->motorMessageText(), "Enabling ..."); - } - if (pl_status != asynSuccess) { - return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", - axisNo_, __PRETTY_FUNCTION__, - __LINE__); - } // The answer to the enable command on MasterMACS might take some time, // hence we wait for a custom timespan in seconds instead of @@ -1148,7 +1138,7 @@ asynStatus masterMacsAxis::enable(bool on) { // Output message to user snprintf(value, sizeof(value), "Failed to %s within %d seconds", on ? "enable" : "disable", timeout_enable_disable); - pl_status = setStringParam(pC_->motorMessageText(), "Enabling ..."); + pl_status = setStringParam(pC_->motorMessageText(), value); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__,