diff --git a/sinqMotor b/sinqMotor index 275672a..b95e782 160000 --- a/sinqMotor +++ b/sinqMotor @@ -1 +1 @@ -Subproject commit 275672aaef41aba2ec425d79f8bbb65d5f18f80c +Subproject commit b95e782ea8de7455a716e82ee9fe860f71024d83 diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index 6cabb95..ce4977e 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -93,8 +93,8 @@ turboPmacAxis::turboPmacAxis(turboPmacController *pC, int axisNo, } // Default values for the watchdog timeout mechanism - offsetMovTimeout_ = 30; // seconds - scaleMovTimeout_ = 2.0; + setOffsetMovTimeout(30.0); // seconds + setScaleMovTimeout(2.0); } turboPmacAxis::~turboPmacAxis(void) { @@ -166,7 +166,7 @@ asynStatus turboPmacAxis::init() { &motorVmax, &motorVelocity, &motorAccel, &acoDelay); // The acoDelay is given in milliseconds -> Convert to seconds, rounded up - offsetMovTimeout_ = std::ceil(acoDelay / 1000.0); + setOffsetMovTimeout(std::ceil(acoDelay / 1000.0)); // The PMAC electronic specifies the acceleration in m/s^2. Since we // otherwise work with the base length mm, the acceleration is converted @@ -1005,6 +1005,10 @@ asynStatus turboPmacAxis::stop(double acceleration) { } } + // Reset the driver to idle state and move out of the handshake wait loop, + // if we're currently inside it. + waitForHandshake_ = false; + return rw_status; } @@ -1039,6 +1043,10 @@ asynStatus turboPmacAxis::doReset() { } } + // Reset the driver to idle state and move out of the handshake wait loop, + // if we're currently inside it. + waitForHandshake_ = false; + return rw_status; } diff --git a/src/turboPmacController.cpp b/src/turboPmacController.cpp index dc80072..a3fd6b0 100644 --- a/src/turboPmacController.cpp +++ b/src/turboPmacController.cpp @@ -55,7 +55,7 @@ turboPmacController::turboPmacController(const char *portName, // Maximum allowed number of subsequent timeouts before the user is // informed. - maxSubsequentTimeouts_ = 10; + setMaxSubsequentTimeouts(10); // ========================================================================= // Create additional parameter library entries @@ -100,7 +100,7 @@ turboPmacController::turboPmacController(const char *portName, const char *message_from_device = "\006"; // Hex-code for ACK (acknowledge) -> Each message from the MCU // is terminated by this value - status = pasynOctetSyncIO->setInputEos(pasynOctetSyncIOipPort_, + status = pasynOctetSyncIO->setInputEos(pasynOctetSyncIOipPort(), message_from_device, strlen(message_from_device)); if (status != asynSuccess) { @@ -109,7 +109,7 @@ turboPmacController::turboPmacController(const char *portName, "(setting input EOS failed with %s).\nTerminating IOC", portName, __PRETTY_FUNCTION__, __LINE__, stringifyAsynStatus(status)); - pasynOctetSyncIO->disconnect(pasynOctetSyncIOipPort_); + pasynOctetSyncIO->disconnect(pasynOctetSyncIOipPort()); exit(-1); } @@ -121,7 +121,7 @@ turboPmacController::turboPmacController(const char *portName, "with %s).\nTerminating IOC", portName, __PRETTY_FUNCTION__, __LINE__, stringifyAsynStatus(status)); - pasynOctetSyncIO->disconnect(pasynOctetSyncIOipPort_); + pasynOctetSyncIO->disconnect(pasynOctetSyncIOipPort()); exit(-1); } @@ -222,13 +222,13 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, if (status == asynTimeout) { - if (msgPrintControl_.shouldBePrinted(comKey, true, pasynUser())) { + if (getMsgPrintControl().shouldBePrinted(comKey, true, pasynUser())) { asynPrint( this->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nTimeout while " "writing to the controller. Retrying ...%s\n", portName, axisNo, __PRETTY_FUNCTION__, __LINE__, - msgPrintControl_.getSuffix()); + getMsgPrintControl().getSuffix()); } timeoutStatus = checkComTimeoutWatchdog(axisNo, drvMessageText, @@ -239,7 +239,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, checkMaxSubsequentTimeouts(timeoutCounter, axis); timeoutCounter += 1; - if (maxSubsequentTimeoutsExceeded_) { + if (maxSubsequentTimeoutsExceeded()) { break; } @@ -255,16 +255,16 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, } } } else if (status != asynSuccess) { - if (msgPrintControl_.shouldBePrinted(comKey, true, pasynUser())) { + if (getMsgPrintControl().shouldBePrinted(comKey, true, pasynUser())) { asynPrint( this->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nError %s while " "writing to the controller.%s\n", portName, axisNo, __PRETTY_FUNCTION__, __LINE__, - stringifyAsynStatus(status), msgPrintControl_.getSuffix()); + stringifyAsynStatus(status), getMsgPrintControl().getSuffix()); } } else { - msgPrintControl_.resetCount(comKey, pasynUser()); + getMsgPrintControl().resetCount(comKey, pasynUser()); } if (timeoutStatus == asynError) { @@ -301,16 +301,17 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, "string detected\"). Please call the support.", reasonStringified); - if (msgPrintControl_.shouldBePrinted(terminateKey, true, pasynUser())) { + if (getMsgPrintControl().shouldBePrinted(terminateKey, true, + pasynUser())) { asynPrint(this->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nMessage " "terminated due to reason %s.%s\n", portName, axisNo, __PRETTY_FUNCTION__, __LINE__, - reasonStringified, msgPrintControl_.getSuffix()); + reasonStringified, getMsgPrintControl().getSuffix()); } } else { - msgPrintControl_.resetCount(terminateKey, pasynUser()); + getMsgPrintControl().resetCount(terminateKey, pasynUser()); } /* @@ -327,15 +328,15 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, if (numExpectedResponses != numReceivedResponses) { adjustResponseForPrint(modResponse, response, MAXBUF_); - if (msgPrintControl_.shouldBePrinted(numResponsesKey, true, - pasynUser())) { + if (getMsgPrintControl().shouldBePrinted(numResponsesKey, true, + pasynUser())) { asynPrint( this->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nUnexpected " "response '%s' (carriage returns are replaced with spaces) " "for command %s.%s\n", portName, axisNo, __PRETTY_FUNCTION__, __LINE__, modResponse, - command, msgPrintControl_.getSuffix()); + command, getMsgPrintControl().getSuffix()); } snprintf(drvMessageText, sizeof(drvMessageText), @@ -345,7 +346,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, modResponse, command); status = asynError; } else { - msgPrintControl_.resetCount(numResponsesKey, pasynUser()); + getMsgPrintControl().resetCount(numResponsesKey, pasynUser()); } // Create custom error messages for different failure modes, if no error @@ -384,15 +385,15 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, paramLibStatus = getIntegerParam(axisNo, motorStatusProblem_, &motorStatusProblem); if (paramLibStatus != asynSuccess) { - return paramLibAccessFailed(paramLibStatus, "motorStatusProblem_", + return paramLibAccessFailed(paramLibStatus, "motorStatusProblem", axisNo, __PRETTY_FUNCTION__, __LINE__); } if (motorStatusProblem == 0) { paramLibStatus = - axis->setStringParam(motorMessageText_, drvMessageText); + axis->setStringParam(motorMessageText(), drvMessageText); if (paramLibStatus != asynSuccess) { - return paramLibAccessFailed(paramLibStatus, "motorMessageText_", + return paramLibAccessFailed(paramLibStatus, "motorMessageText", axisNo, __PRETTY_FUNCTION__, __LINE__); } @@ -407,7 +408,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command, paramLibStatus = axis->setIntegerParam(motorStatusProblem_, 1); if (paramLibStatus != asynSuccess) { return paramLibAccessFailed(paramLibStatus, - "motorStatusCommsError_", axisNo, + "motorStatusCommsError", axisNo, __PRETTY_FUNCTION__, __LINE__); } }