From b09f081db949937615ec177d95af46d2569e8a7b Mon Sep 17 00:00:00 2001 From: smathis Date: Thu, 15 May 2025 13:35:16 +0200 Subject: [PATCH] Updated turboPmac and sinqMotor versions --- src/seleneAngleAxis.cpp | 22 ++++++++++++++++++---- src/seleneLiftAxis.cpp | 14 ++++++++++++++ src/seleneOffsetAxis.cpp | 14 ++++++++++++++ turboPmac | 2 +- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/seleneAngleAxis.cpp b/src/seleneAngleAxis.cpp index 3a0152a..6b8525c 100644 --- a/src/seleneAngleAxis.cpp +++ b/src/seleneAngleAxis.cpp @@ -22,6 +22,20 @@ seleneAngleAxis::seleneAngleAxis(seleneGuideController *pController, int axisNo, pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_, __PRETTY_FUNCTION__, __LINE__); } + + // Even though this happens already in sinqAxis, a default value for + // motorMessageText is set here again, because apparently the sinqAxis + // constructor is not run before the string is accessed? + status = setStringParam(pC_->motorMessageText(), ""); + if (status != asynSuccess) { + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, + "Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR " + "(setting a parameter value failed " + "with %s)\n. Terminating IOC", + pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, + pC_->stringifyAsynStatus(status)); + exit(-1); + } } asynStatus seleneAngleAxis::stop(double acceleration) { @@ -59,7 +73,7 @@ asynStatus seleneAngleAxis::targetPosition(double *targetPosition) { asynStatus seleneAngleAxis::doPoll(bool *moving) { - char userMessage[pC_->MAXBUF_] = {0}; + char errorMessage[pC_->MAXBUF_] = {0}; // In the doPoll method of `seleneLiftAxis`, the parameters // `motorStatusMoving` and `motorStatusDone` of this axis have already been @@ -189,15 +203,15 @@ asynStatus seleneAngleAxis::doPoll(bool *moving) { // axis. pl_status = pC_->getStringParam(liftAxis_->axisNo(), pC_->motorMessageText(), - sizeof(userMessage), userMessage); + sizeof(errorMessage), errorMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText", liftAxis_->axisNo(), __PRETTY_FUNCTION__, __LINE__); } - if (strlen(userMessage) != 0) { - pl_status = setStringParam(pC_->motorMessageText(), userMessage); + if (strlen(errorMessage) != 0) { + pl_status = setStringParam(pC_->motorMessageText(), errorMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, diff --git a/src/seleneLiftAxis.cpp b/src/seleneLiftAxis.cpp index f4abe89..fd03160 100644 --- a/src/seleneLiftAxis.cpp +++ b/src/seleneLiftAxis.cpp @@ -99,6 +99,20 @@ seleneLiftAxis::seleneLiftAxis(seleneGuideController *pC, int axis1No, pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_, __PRETTY_FUNCTION__, __LINE__); } + + // Even though this happens already in sinqAxis, a default value for + // motorMessageText is set here again, because apparently the sinqAxis + // constructor is not run before the string is accessed? + status = setStringParam(pC_->motorMessageText(), ""); + if (status != asynSuccess) { + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, + "Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR " + "(setting a parameter value failed " + "with %s)\n. Terminating IOC", + pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, + pC_->stringifyAsynStatus(status)); + exit(-1); + } } asynStatus seleneLiftAxis::init() { diff --git a/src/seleneOffsetAxis.cpp b/src/seleneOffsetAxis.cpp index 2a6abad..159bbee 100644 --- a/src/seleneOffsetAxis.cpp +++ b/src/seleneOffsetAxis.cpp @@ -80,6 +80,20 @@ seleneOffsetAxis::seleneOffsetAxis(seleneGuideController *pController, pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_, __PRETTY_FUNCTION__, __LINE__); } + + // Even though this happens already in sinqAxis, a default value for + // motorMessageText is set here again, because apparently the sinqAxis + // constructor is not run before the string is accessed? + status = setStringParam(pC_->motorMessageText(), ""); + if (status != asynSuccess) { + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, + "Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR " + "(setting a parameter value failed " + "with %s)\n. Terminating IOC", + pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, + pC_->stringifyAsynStatus(status)); + exit(-1); + } } asynStatus seleneOffsetAxis::init() { diff --git a/turboPmac b/turboPmac index 2f83060..75292a6 160000 --- a/turboPmac +++ b/turboPmac @@ -1 +1 @@ -Subproject commit 2f83060ec145636ad949d89534c129453b1b06e6 +Subproject commit 75292a6a9c696fbfcb4962281d1a2cf80819c83f