diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index 2c3e374..6f5444d 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -428,9 +428,14 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity, return pC_->wakeupPoller(); } else if (status == asynError) { + // asynError means that we tried to home an absolute encoder - setAxisParamChecked(this, motorErrorMessage, - "Can't home a motor with absolute encoder"); + char msg[pC_->MAXBUF_]; + snprintf(msg, sizeof(msg), + "Controller \"%s\", axis %d: Can't home a motor with absolute " + "encoder.", + pC_->portName, axisNo()); + setAxisParamChecked(this, motorErrorMessage, msg); status = assertConnected(); if (status != asynSuccess) { @@ -566,9 +571,14 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) { "vmax=%lf.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, vbas, vmax); - setAxisParamChecked(this, motorErrorMessage, - "Lower speed limit must not be smaller than " - "upper speed limit. Please call the support."); + + char msg[pC_->MAXBUF_]; + snprintf( + msg, sizeof(msg), + "Controller \"%s\", axis %d: Lower speed limit must not " + "be smaller than upper speed limit. Please call the support.", + pC_->portName, axisNo()); + setAxisParamChecked(this, motorErrorMessage, msg); return asynError; } if (velo < vbas || velo > vmax) { @@ -579,10 +589,13 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) { pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, velo, vbas, vmax); - setAxisParamChecked( - this, motorErrorMessage, - "Speed is not inside limits. Set a new valid speed and try " - "to move the motor. Otherwise, please call the support."); + char msg[pC_->MAXBUF_]; + snprintf(msg, sizeof(msg), + "Controller \"%s\", axis %d: Speed is not inside limits. " + "Set a new valid speed and try to move the motor. " + "Otherwise, please call the support.", + pC_->portName, axisNo()); + setAxisParamChecked(this, motorErrorMessage, msg); return asynError; } @@ -722,9 +735,13 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) { pSinqA_->expectedArrivalTime, time(NULL)); } - setAxisParamChecked( - this, motorErrorMessage, - "Exceeded expected arrival time. Check if the axis is blocked."); + char msg[pC_->MAXBUF_]; + snprintf(msg, sizeof(msg), + "Controller \"%s\", axis %d: Exceeded expected arrival time. " + "Check if the axis is blocked.", + pC_->portName, axisNo()); + + setAxisParamChecked(this, motorErrorMessage, msg); setAxisParamChecked(this, motorStatusProblem, true); } else { pC_->getMsgPrintControl().resetCount(key, pC_->pasynUser()); diff --git a/src/sinqController.cpp b/src/sinqController.cpp index e54c08d..0e31c8b 100644 --- a/src/sinqController.cpp +++ b/src/sinqController.cpp @@ -503,9 +503,12 @@ asynStatus sinqController::couldNotParseResponse(const char *command, return asynError; } - setAxisParamChecked( - axis, motorErrorMessage, - "Could not interpret controller response. Please call the support"); + char msg[MAXBUF_]; + snprintf(msg, sizeof(msg), + "Controller \"%s\", axis %d: Could not interpret controller " + "response \"%s\" for command \"%s\". Please call the support.", + portName, axisNo, response, command); + setAxisParamChecked(axis, motorErrorMessage, msg); setAxisParamChecked(axis, motorStatusCommsError, true); return asynError; @@ -573,9 +576,10 @@ asynStatus sinqController::checkComTimeoutWatchdog(int axisNo, if (wantToPrint) { snprintf(motorMessage, motorMessageSize, - "More than %ld communication timeouts in %ld seconds. Please " - "call the support.", - pSinqC_->maxNumberTimeouts, pSinqC_->comTimeoutWindow); + "Controller \"%s\", axis %d: More than %ld communication " + "timeouts in %ld seconds. Please call the support.", + portName, axisNo, pSinqC_->maxNumberTimeouts, + pSinqC_->comTimeoutWindow); paramLibStatus = setIntegerParam(motorStatusCommsError_, 1); if (paramLibStatus != asynSuccess) { @@ -609,9 +613,11 @@ asynStatus sinqController::checkMaxSubsequentTimeouts(int timeoutNo, int axisNo, if (timeoutNo >= pSinqC_->maxSubsequentTimeouts) { if (!pSinqC_->maxSubsequentTimeoutsExceeded) { - snprintf(motorMessage, motorMessageSize, - "Communication timeout between IOC and motor controller. " - "Trying to reconnect ..."); + snprintf( + motorMessage, motorMessageSize, + "Controller \"%s\", axis %d: Communication timeout " + "between IOC and motor controller. Trying to reconnect ...", + portName, axisNo); asynPrint( this->pasynUserSelf, ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d:\nMore than %d "