From db40475133257b91ebcab6b759b14145c1e159fb Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 10 Jun 2026 09:27:44 +0200 Subject: [PATCH 1/6] Fixed sinqMotor dependency --- sinqMotor | 2 +- src/turboPmacAxis.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sinqMotor b/sinqMotor index 4e30331..95bc899 160000 --- a/sinqMotor +++ b/sinqMotor @@ -1 +1 @@ -Subproject commit 4e30331c92a1c212e4b5f46996e4b7853c559136 +Subproject commit 95bc899114f90fa0b5925054d1eb374db9678bd7 diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index a88e6db..2754a79 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -218,7 +218,7 @@ asynStatus turboPmacAxis::init() { // here to mm/s^2. motorAccel = motorAccel * 1000; - if (nvals != 8) { + if (nvals != 7) { return pC_->couldNotParseResponse(command, response, axisNo_, __PRETTY_FUNCTION__, __LINE__); } @@ -444,6 +444,8 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { case -5: // Axis is deactivated *moving = false; + setAxisParamChecked(this, motorMessageText, + "Deactivated. Please call the support."); break; case -4: // Emergency stop @@ -459,7 +461,9 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { pC_->getMsgPrintControl().getSuffix()); } resetCountStatus = false; - setAxisParamChecked(this, motorMessageText, "Emergency stop"); + setAxisParamChecked( + this, motorMessageText, + "Emergency stop. Reset SPS or check emergency stop buttons."); break; case -3: // Disabled @@ -615,7 +619,7 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage, pC_->getMsgPrintControl().getSuffix()); } setAxisParamChecked(this, motorMessageText, - "Target position would exceed software limits"); + "Target position would exceed software limits."); break; case 5: // Command not possible @@ -630,9 +634,9 @@ asynStatus turboPmacAxis::handleError(int error, char *userMessage, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->getMsgPrintControl().getSuffix()); } - setAxisParamChecked(this, motorMessageText, - "Axis received move command while it is still " - "moving. Please call the support."); + setAxisParamChecked( + this, motorMessageText, + "Axis received move command while it is not ready."); break; case 8: if (pC_->getMsgPrintControl().shouldBePrinted( From bf56e49729a68eb9e3e84d4ee8d4a1d2429b7f53 Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 10 Jun 2026 09:40:46 +0200 Subject: [PATCH 2/6] Report if motor is deactivated or in emergency stop mode --- src/turboPmacAxis.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index 2754a79..476005c 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -289,7 +289,7 @@ asynStatus turboPmacAxis::init() { asynStatus turboPmacAxis::doPoll(bool *moving) { // Return value for the poll - asynStatus errorStatus = asynSuccess; + asynStatus pollStatus = asynSuccess; // Status of read-write-operations of ASCII commands to the controller asynStatus status = asynSuccess; @@ -446,6 +446,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { *moving = false; setAxisParamChecked(this, motorMessageText, "Deactivated. Please call the support."); + pollStatus = asynError; break; case -4: // Emergency stop @@ -454,9 +455,8 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { if (pC_->getMsgPrintControl().shouldBePrinted(keyStatus, true, pC_->pasynUser())) { asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, - "Controller \"%s\", axis %d => %s, line " - "%d\nEmergency stop " - "activated.%s\n", + "Controller \"%s\", axis %d => %s, line %d\nEmergency " + "stop activated.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->getMsgPrintControl().getSuffix()); } @@ -464,6 +464,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { setAxisParamChecked( this, motorMessageText, "Emergency stop. Reset SPS or check emergency stop buttons."); + pollStatus = asynError; break; case -3: // Disabled @@ -572,7 +573,11 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { } } - errorStatus = handleError(error, userMessage, sizeof(userMessage)); + asynStatus errorStatus = + handleError(error, userMessage, sizeof(userMessage)); + if (errorStatus != asynSuccess) { + pollStatus = errorStatus; + } if (*moving == false) { setAxisParamChecked(this, motorMoveToHome, false); @@ -594,7 +599,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { if (status != asynSuccess) { return status; } - return errorStatus; + return pollStatus; } asynStatus turboPmacAxis::handleError(int error, char *userMessage, From c1df82676c29a22766963877fee25bee3bbb4261 Mon Sep 17 00:00:00 2001 From: smathis Date: Thu, 2 Jul 2026 13:56:22 +0200 Subject: [PATCH 3/6] Emergency stop is now counted as "Axis disabled" This prevents sending another command while the motor is in emergency stop and also provides a pop-up window on NICOS "for free". --- src/turboPmacAxis.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index 476005c..f301f67 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -425,8 +425,9 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { // Update the enablement PV, if we are not in the middle of a enabling / // disabling procedure. if (!(pTurboPmacA_->enableDisable)) { - setAxisParamChecked(this, motorEnableRBV, - (axStatus != -3 && axStatus != -5)); + setAxisParamChecked( + this, motorEnableRBV, + (axStatus != -3 && axStatus != -4 && axStatus != -5)); } // Create the unique callsite identifier manually so it can be used From dcdfbb2b37bbf6de86b4e4fc4d5963818e536ff2 Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 15 Jul 2026 11:06:44 +0200 Subject: [PATCH 4/6] Updated to sinqMotor 1.6.1 --- sinqMotor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sinqMotor b/sinqMotor index 95bc899..3631064 160000 --- a/sinqMotor +++ b/sinqMotor @@ -1 +1 @@ -Subproject commit 95bc899114f90fa0b5925054d1eb374db9678bd7 +Subproject commit 363106446971d6a247fc020242bd810b664d43ac From 9841345f0641d904df848d89f74035c0e26560f9 Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 5 Aug 2026 08:31:49 +0200 Subject: [PATCH 5/6] Read out correct position deadband register (read out wrong one before) --- src/turboPmacAxis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index f301f67..cc8f561 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -176,7 +176,7 @@ asynStatus turboPmacAxis::init() { Ixx65. */ snprintf(command, sizeof(command), - "Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d65", + "Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d28", axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_); status = pC_->writeRead(axisNo_, command, response, 7); From 2c254786738b17c623046e0286af90871b62d5c5 Mon Sep 17 00:00:00 2001 From: smathis Date: Mon, 26 Oct 2026 09:05:22 +0100 Subject: [PATCH 6/6] Improved reporting of communication errors --- src/turboPmacController.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/turboPmacController.cpp b/src/turboPmacController.cpp index 8b7f084..c37a280 100644 --- a/src/turboPmacController.cpp +++ b/src/turboPmacController.cpp @@ -346,18 +346,18 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, snprintf(reasonStringified, sizeof(reasonStringified), "Request count reached"); break; - case 2: - snprintf(reasonStringified, sizeof(reasonStringified), - "End of string detected"); - break; case 3: snprintf(reasonStringified, sizeof(reasonStringified), "End indicator detected"); break; + default: + snprintf(reasonStringified, sizeof(reasonStringified), + "Unknown eomReason %d", eomReason); + break; } snprintf(drvMessageText, sizeof(drvMessageText), - "Terminated message due to reason %s (should be \"End of " + "Terminated message due to \"%s\" (should be \"End of " "string detected\"). Please call the support.", reasonStringified); @@ -410,22 +410,22 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, } // Create custom error messages for different failure modes, if no error - // message has been set yet + // message has been set yet. if (strlen(drvMessageText) == 0) { switch (status) { case asynSuccess: break; // Communicate nothing case asynTimeout: snprintf(drvMessageText, sizeof(drvMessageText), - "connection timeout for axis %d", axisNo); + "Connection timeout for axis %d", axisNo); break; case asynDisconnected: snprintf(drvMessageText, sizeof(drvMessageText), - "axis is not connected"); + "Axis is not connected"); break; case asynDisabled: snprintf(drvMessageText, sizeof(drvMessageText), - "axis is disabled"); + "Axis is disabled"); break; default: snprintf(drvMessageText, sizeof(drvMessageText), @@ -438,13 +438,16 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, if (status == asynSuccess) { setAxisParamChecked(axis, motorStatusCommsError, false); } else { - // Check if the axis already is in an error communication mode. If - // it is not, upstream the error. This is done to avoid "flooding" - // the user with different error messages if more than one error - // ocurred before an error-free communication + // Check if the axis already is in an error communication mode (motor + // has status problem and an error message already exists). If either + // one of these conditions are not fulfilled, upstream the error. This + // is done to avoid "flooding" the user with different error messages if + // more than one error ocurred before an error-free communication + char oldMsg[MAXBUF_] = {0}; + getAxisParamChecked(axis, motorMessageText, oldMsg); getAxisParamChecked(axis, motorStatusProblem, &motorStatusProblem); - if (motorStatusProblem == 0) { + if (motorStatusProblem == 0 || oldMsg[0] == 0) { setAxisParamChecked(axis, motorMessageText, drvMessageText); setAxisParamChecked(axis, motorStatusProblem, true); setAxisParamChecked(axis, motorStatusCommsError, true);