Adjusted usage of motorMessageText to be an error text only

This commit is contained in:
2025-05-14 16:28:51 +02:00
parent 989410474e
commit e93f11e779
2 changed files with 14 additions and 24 deletions

View File

@ -23,4 +23,4 @@ SOURCES += src/masterMacsController.cpp
# This file registers the motor-specific functions in the IOC shell. # This file registers the motor-specific functions in the IOC shell.
DBDS += src/masterMacs.dbd DBDS += src/masterMacs.dbd
USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wpedantic -Wextra -Werror USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wextra -Werror

View File

@ -460,7 +460,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
// This buffer must be initialized to zero because we build the // This buffer must be initialized to zero because we build the
// error message by appending strings. // error message by appending strings.
char userMessage[pC_->MAXBUF_] = {0}; char errorMessage[pC_->MAXBUF_] = {0};
char shellMessage[pC_->MAXBUF_] = {0}; char shellMessage[pC_->MAXBUF_] = {0};
// Concatenate all other errors // Concatenate all other errors
@ -468,7 +468,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Short circuit fault."); "Short circuit fault.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Short circuit error. Please call the support."); "Short circuit error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -477,7 +477,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
if (encoderError()) { if (encoderError()) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Encoder error."); "Encoder error.");
appendErrorMessage(userMessage, sizeof(userMessage), appendErrorMessage(errorMessage, sizeof(errorMessage),
"Encoder error. Please call the support."); "Encoder error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -488,7 +488,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
shellMessage, sizeof(shellMessage), shellMessage, sizeof(shellMessage),
"Maximum callowed following error exceeded."); "Maximum callowed following error exceeded.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Maximum allowed following error exceeded.Check if " "Maximum allowed following error exceeded.Check if "
"movement range is blocked. Otherwise please call the " "movement range is blocked. Otherwise please call the "
"support."); "support.");
@ -499,7 +499,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
if (feedbackError()) { if (feedbackError()) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Feedback error."); "Feedback error.");
appendErrorMessage(userMessage, sizeof(userMessage), appendErrorMessage(errorMessage, sizeof(errorMessage),
"Feedback error. Please call the support."); "Feedback error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -535,7 +535,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
// Generic error message for user // Generic error message for user
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Software limits or end switch hit. Try homing the motor, " "Software limits or end switch hit. Try homing the motor, "
"moving in the opposite direction or check the SPS for " "moving in the opposite direction or check the SPS for "
"errors (if available). Otherwise please call the " "errors (if available). Otherwise please call the "
@ -548,7 +548,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Overcurrent error."); "Overcurrent error.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Overcurrent error. Please call the support."); "Overcurrent error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -558,7 +558,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Overtemperature error."); "Overtemperature error.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Overtemperature error. Please call the support."); "Overtemperature error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -568,7 +568,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Overvoltage error."); "Overvoltage error.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Overvoltage error. Please call the support."); "Overvoltage error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -578,7 +578,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"Undervoltage error."); "Undervoltage error.");
appendErrorMessage( appendErrorMessage(
userMessage, sizeof(userMessage), errorMessage, sizeof(errorMessage),
"Undervoltage error. Please call the support."); "Undervoltage error. Please call the support.");
poll_status = asynError; poll_status = asynError;
@ -587,7 +587,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
if (stoFault()) { if (stoFault()) {
appendErrorMessage(shellMessage, sizeof(shellMessage), appendErrorMessage(shellMessage, sizeof(shellMessage),
"STO input is on disable state."); "STO input is on disable state.");
appendErrorMessage(userMessage, sizeof(userMessage), appendErrorMessage(errorMessage, sizeof(errorMessage),
"STO fault. Please call the support."); "STO fault. Please call the support.");
poll_status = asynError; 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) { if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__, axisNo_, __PRETTY_FUNCTION__,
@ -1093,16 +1093,6 @@ asynStatus masterMacsAxis::enable(bool on) {
"Controller \"%s\", axis %d => %s, line %d:\n%s axis.\n", "Controller \"%s\", axis %d => %s, line %d:\n%s axis.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
on ? "Enable" : "Disable"); 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, // The answer to the enable command on MasterMACS might take some time,
// hence we wait for a custom timespan in seconds instead of // hence we wait for a custom timespan in seconds instead of
@ -1148,7 +1138,7 @@ asynStatus masterMacsAxis::enable(bool on) {
// Output message to user // Output message to user
snprintf(value, sizeof(value), "Failed to %s within %d seconds", snprintf(value, sizeof(value), "Failed to %s within %d seconds",
on ? "enable" : "disable", timeout_enable_disable); on ? "enable" : "disable", timeout_enable_disable);
pl_status = setStringParam(pC_->motorMessageText(), "Enabling ..."); pl_status = setStringParam(pC_->motorMessageText(), value);
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__, axisNo_, __PRETTY_FUNCTION__,