Adjusted usage of motorMessageText to act as an error message only.

This commit is contained in:
2025-05-14 16:17:14 +02:00
parent 2c5fdc7d0a
commit a3e3a79788

View File

@ -397,13 +397,6 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
case -5: case -5:
// Axis is deactivated // Axis is deactivated
*moving = false; *moving = false;
pl_status = setStringParam(pC_->motorMessageText(), "Deactivated");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
break; break;
case -4: case -4:
// Emergency stop // Emergency stop
@ -426,19 +419,10 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
axisNo_, __PRETTY_FUNCTION__, axisNo_, __PRETTY_FUNCTION__,
__LINE__); __LINE__);
} }
break; break;
case -3: case -3:
// Disabled // Disabled
*moving = false; *moving = false;
pl_status = setStringParam(pC_->motorMessageText(), "Disabled");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
break; break;
case 0: case 0:
// Idle // Idle
@ -599,8 +583,7 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage,
resetError = false; resetError = false;
status = setStringParam(pC_->motorMessageText(), status = setStringParam(pC_->motorMessageText(),
"Target position would exceed software " "Target position would exceed software limits");
"limits. Please call the support.");
if (status != asynSuccess) { if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorMessageText_", return pC_->paramLibAccessFailed(status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__, axisNo_, __PRETTY_FUNCTION__,
@ -783,10 +766,10 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage,
} }
resetError = false; resetError = false;
snprintf(userMessage, sizeUserMessage, snprintf(
"Driver hardware error (P%2.2d01 = 13). " userMessage, sizeUserMessage,
"Please call the support.", "Driver hardware error (P%2.2d01 = 13). Please call the support.",
axisNo_); axisNo_);
status = setStringParam(pC_->motorMessageText(), userMessage); status = setStringParam(pC_->motorMessageText(), userMessage);
if (status != asynSuccess) { if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorMessageText_", return pC_->paramLibAccessFailed(status, "motorMessageText_",
@ -1084,22 +1067,7 @@ asynStatus turboPmacAxis::doHome(double min_velocity, double max_velocity,
axisNo_, __PRETTY_FUNCTION__, axisNo_, __PRETTY_FUNCTION__,
__LINE__); __LINE__);
} }
pl_status = setStringParam(pC_->motorMessageText(), "Homing");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
return callParamCallbacks(); return callParamCallbacks();
} else {
pl_status = setStringParam(pC_->motorMessageText(),
"Can't home a motor with absolute encoder");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
return asynSuccess; return asynSuccess;
@ -1330,16 +1298,7 @@ asynStatus turboPmacAxis::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__);
}
rw_status = pC_->writeRead(axisNo_, command, response, 0); rw_status = pC_->writeRead(axisNo_, command, response, 0);
if (rw_status != asynSuccess) { if (rw_status != asynSuccess) {
return rw_status; return rw_status;
@ -1382,12 +1341,6 @@ asynStatus turboPmacAxis::enable(bool on) {
// Output message to user // Output message to user
snprintf(command, sizeof(command), "Failed to %s within %d seconds", snprintf(command, sizeof(command), "Failed to %s within %d seconds",
on ? "enable" : "disable", timeout_enable_disable); on ? "enable" : "disable", timeout_enable_disable);
pl_status = setStringParam(pC_->motorMessageText(), "Enabling ...");
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
return asynError; return asynError;
} }