10 Commits
1.0.0 ... main

Author SHA1 Message Date
f9fbccbe6e Fixed compiler warnings
Some checks failed
Test And Build / Lint (push) Successful in 3s
Test And Build / Build (push) Failing after 6s
2025-12-23 13:33:23 +01:00
edc5e93eae Updated turboPmac driver 2025-12-23 13:29:15 +01:00
b2acc86a33 Updated turboPmac to fix segfault originated in sinqMotor 2025-12-23 12:17:30 +01:00
36cb878f68 Removed C++ only flag and updated turboPmac
All checks were successful
Test And Build / Lint (push) Successful in 3s
Test And Build / Build (push) Successful in 13s
2025-08-22 15:32:49 +02:00
c8bd7755b7 Updated sinqMotor to fix bug in forcedPoll
All checks were successful
Test And Build / Lint (push) Successful in 2s
Test And Build / Build (push) Successful in 13s
2025-08-14 17:27:54 +02:00
b7bc762cec Updated turboPmac to 1.4.0
All checks were successful
Test And Build / Lint (push) Successful in 3s
Test And Build / Build (push) Successful in 13s
2025-08-12 09:33:26 +02:00
5258ac6be6 adds gitea action
All checks were successful
Test And Build / Lint (push) Successful in 2s
Test And Build / Build (push) Successful in 14s
2025-07-04 14:38:57 +02:00
5e61af6625 Removed unneeded variables 2025-06-18 08:55:12 +02:00
ca52a7398e Updated to macro usage for paramLib interaction 2025-06-18 08:51:41 +02:00
bc0d8d33dd Updated turboPmac 2025-06-18 08:37:07 +02:00
5 changed files with 95 additions and 138 deletions

View File

@@ -0,0 +1,30 @@
name: Test And Build
on: [push]
jobs:
Lint:
runs-on: linepics
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: cppcheck
run: cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 src/*.cpp
- name: formatting
run: clang-format --style=file --Werror --dry-run src/*.cpp src/*.h
Build:
runs-on: linepics
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
submodules: 'true'
- run: |
pushd turboPmac
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
echo -e "\nIGNORE_SUBMODULES += sinqmotor" >> Makefile
make install
popd
- run: |
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
echo -e "\nIGNORE_SUBMODULES += turboPmac" >> Makefile
make install

View File

@@ -35,4 +35,5 @@ DBDS += turboPmac/sinqMotor/src/sinqMotor.dbd
DBDS += turboPmac/src/turboPmac.dbd DBDS += turboPmac/src/turboPmac.dbd
DBDS += src/beamShift.dbd DBDS += src/beamShift.dbd
USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Werror # -Wpedantic // Does not work because EPICS macros trigger warnings USR_CFLAGS += -Wall -Wextra -Wunused-result -Werror # -Wpedantic // Does not work because EPICS macros trigger warnings
USR_CXXFLAGS += -Wall -Wextra -Wunused-result -Werror

View File

@@ -64,15 +64,25 @@ beamShiftAxis::beamShiftAxis(turboPmacController *pC, int axisNo)
// The girder translation cannot be disabled // The girder translation cannot be disabled
status = pC_->setIntegerParam(axisNo, pC_->motorCanDisable(), 0); status = pC_->setIntegerParam(axisNo, pC_->motorCanDisable(), 0);
if (status != asynSuccess) { if (status != asynSuccess) {
pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo, asynPrint(
__PRETTY_FUNCTION__, __LINE__); 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);
} }
// The girder translation speed cannot be changed // The girder translation speed cannot be changed
status = pC_->setIntegerParam(axisNo, pC_->motorCanSetSpeed(), 0); status = pC_->setIntegerParam(axisNo, pC_->motorCanSetSpeed(), 0);
if (status != asynSuccess) { if (status != asynSuccess) {
pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo, asynPrint(
__PRETTY_FUNCTION__, __LINE__); 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);
} }
} }
@@ -136,7 +146,7 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
asynStatus errorStatus = asynSuccess; asynStatus errorStatus = asynSuccess;
// Status of read-write-operations of ASCII commands to the controller // Status of read-write-operations of ASCII commands to the controller
asynStatus rw_status = asynSuccess; asynStatus status = asynSuccess;
// Status of parameter library operations // Status of parameter library operations
asynStatus pl_status = asynSuccess; asynStatus pl_status = asynSuccess;
@@ -172,9 +182,9 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
- Lower limit - Lower limit
*/ */
snprintf(command, sizeof(command), "P154 Q110 P158 P159 Q113 Q114"); snprintf(command, sizeof(command), "P154 Q110 P158 P159 Q113 Q114");
rw_status = pC_->writeRead(axisNo(), command, response, 6); status = pC_->writeRead(axisNo(), command, response, 6);
if (rw_status != asynSuccess) { if (status != asynSuccess) {
return rw_status; return status;
}; };
nvals = sscanf(response, "%d %lf %d %d %lf %lf", (int *)moving, nvals = sscanf(response, "%d %lf %d %d %lf %lf", (int *)moving,
@@ -196,22 +206,12 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
directly, but need to shrink them a bit. In this case, we're shrinking them directly, but need to shrink them a bit. In this case, we're shrinking them
by limitsOffset on both sides. by limitsOffset on both sides.
*/ */
pl_status = getAxisParamChecked(this, motorLimitsOffset, &limitsOffset);
pC_->getDoubleParam(axisNo(), pC_->motorLimitsOffset(), &limitsOffset);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorLimitsOffset_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
highLimit = highLimit - limitsOffset; highLimit = highLimit - limitsOffset;
lowLimit = lowLimit + limitsOffset; lowLimit = lowLimit + limitsOffset;
// Update the enablement PV. // Update the enablement PV.
pl_status = setIntegerParam(pC_->motorEnableRBV(), enabled); setAxisParamChecked(this, motorEnableRBV, enabled);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo(),
__PRETTY_FUNCTION__, __LINE__);
}
if (*moving) { if (*moving) {
// If the axis is moving, evaluate the movement direction // If the axis is moving, evaluate the movement direction
@@ -223,67 +223,22 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
} }
errorStatus = handleError(error, userMessage, sizeof(userMessage)); errorStatus = handleError(error, userMessage, sizeof(userMessage));
pl_status = setStringParam(pC_->motorMessageText(), userMessage); setAxisParamChecked(this, motorMessageText, userMessage);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMessageText",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
// Update the parameter library // Update the parameter library
if (error != 0) { if (error != 0) {
pl_status = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
} }
if (*moving == false) { if (*moving == false) {
pl_status = setIntegerParam(pC_->motorMoveToHome(), 0); setAxisParamChecked(this, motorMoveToHome, false);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
} }
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving); setAxisParamChecked(this, motorStatusMoving, *moving);
if (pl_status != asynSuccess) { setAxisParamChecked(this, motorStatusMoving, !(*moving));
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving_", setAxisParamChecked(this, motorStatusDirection, direction);
axisNo(), __PRETTY_FUNCTION__, setAxisParamChecked(this, motorHighLimitFromDriver, highLimit);
__LINE__); setAxisParamChecked(this, motorLowLimitFromDriver, lowLimit);
}
pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving));
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
pl_status = setIntegerParam(pC_->motorStatusDirection(), direction);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorStatusDirection_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
pl_status = pC_->setDoubleParam(axisNo(), pC_->motorHighLimitFromDriver(),
highLimit);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
pl_status =
pC_->setDoubleParam(axisNo(), pC_->motorLowLimitFromDriver(), lowLimit);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_", axisNo(),
__PRETTY_FUNCTION__, __LINE__);
}
pl_status = setMotorPosition(currentPosition); pl_status = setMotorPosition(currentPosition);
if (pl_status != asynSuccess) { if (pl_status != asynSuccess) {
@@ -420,12 +375,8 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
snprintf(userMessage, sizeUserMessage, snprintf(userMessage, sizeUserMessage,
"Unknown error P%2.2d01 = %d. Please call the support.", "Unknown error P%2.2d01 = %d. Please call the support.",
axisNo(), error); axisNo(), error);
status = setStringParam(pC_->motorMessageText(), userMessage);
if (status != asynSuccess) { setAxisParamChecked(this, motorMessageText, userMessage);
return pC_->paramLibAccessFailed(status, "motorMessageText_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
status = asynError; status = asynError;
break; break;
@@ -442,10 +393,7 @@ asynStatus beamShiftAxis::doMove(double position, int relative,
double acceleration) { double acceleration) {
// Status of read-write-operations of ASCII commands to the controller // Status of read-write-operations of ASCII commands to the controller
asynStatus rw_status = asynSuccess; asynStatus status = asynSuccess;
// Status of parameter library operations
asynStatus pl_status = asynSuccess;
char command[pC_->MAXBUF_] = {0}; char command[pC_->MAXBUF_] = {0};
char response[pC_->MAXBUF_] = {0}; char response[pC_->MAXBUF_] = {0};
@@ -455,19 +403,14 @@ asynStatus beamShiftAxis::doMove(double position, int relative,
// ========================================================================= // =========================================================================
pl_status = pC_->getIntegerParam(axisNo(), pC_->motorEnableRBV(), &enabled); // Suppress unused variables warnings
if (pl_status != asynSuccess) { (void)relative;
return pC_->paramLibAccessFailed(pl_status, "enableMotorRBV_", axisNo(), (void)minVelocity;
__PRETTY_FUNCTION__, __LINE__); (void)maxVelocity;
} (void)acceleration;
pl_status = pC_->getDoubleParam(axisNo(), pC_->motorRecResolution(), getAxisParamChecked(this, motorEnableRBV, &enabled);
&motorRecResolution); getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
if (enabled == 0) { if (enabled == 0) {
asynPrint( asynPrint(
@@ -490,8 +433,8 @@ asynStatus beamShiftAxis::doMove(double position, int relative,
motorCoordinatesPosition); motorCoordinatesPosition);
// We don't expect an answer // We don't expect an answer
rw_status = pC_->writeRead(axisNo(), command, response, 0); status = pC_->writeRead(axisNo(), command, response, 0);
if (rw_status != asynSuccess) { if (status != asynSuccess) {
asynPrint( asynPrint(
pC_->pasynUser(), ASYN_TRACE_ERROR, pC_->pasynUser(), ASYN_TRACE_ERROR,
@@ -499,14 +442,9 @@ asynStatus beamShiftAxis::doMove(double position, int relative,
"target position %lf failed.\n", "target position %lf failed.\n",
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__,
motorCoordinatesPosition); motorCoordinatesPosition);
pl_status = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
} }
return rw_status; return status;
} }
asynStatus beamShiftAxis::stop(double acceleration) { asynStatus beamShiftAxis::stop(double acceleration) {
@@ -515,6 +453,9 @@ asynStatus beamShiftAxis::stop(double acceleration) {
// ========================================================================= // =========================================================================
// Suppress unused variables warnings
(void)acceleration;
return pC_->writeRead(axisNo(), "P150=8", response, 0); return pC_->writeRead(axisNo(), "P150=8", response, 0);
} }
@@ -531,8 +472,15 @@ asynStatus beamShiftAxis::doReset() {
/* /*
This is a no-op. This is a no-op.
*/ */
asynStatus beamShiftAxis::doHome(double min_velocity, double max_velocity, asynStatus beamShiftAxis::doHome(double minVelocity, double maxVelocity,
double acceleration, int forwards) { double acceleration, int forwards) {
// Suppress unused variables warnings
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
(void)forwards;
return asynSuccess; return asynSuccess;
} }
@@ -540,12 +488,7 @@ asynStatus beamShiftAxis::doHome(double min_velocity, double max_velocity,
Encoder type is absolute encoder Encoder type is absolute encoder
*/ */
asynStatus beamShiftAxis::readEncoderType() { asynStatus beamShiftAxis::readEncoderType() {
setAxisParamChecked(this, encoderType, AbsoluteEncoder);
asynStatus pl_status = setStringParam(pC_->encoderType(), AbsoluteEncoder);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo(),
__PRETTY_FUNCTION__, __LINE__);
}
return asynSuccess; return asynSuccess;
} }
@@ -553,7 +496,6 @@ asynStatus beamShiftAxis::enable(bool on) {
char command[pC_->MAXBUF_] = {0}; char command[pC_->MAXBUF_] = {0};
char response[pC_->MAXBUF_] = {0}; char response[pC_->MAXBUF_] = {0};
char userMessage[pC_->MAXBUF_] = {0}; char userMessage[pC_->MAXBUF_] = {0};
asynStatus status = asynSuccess;
int nvals = 0; int nvals = 0;
int error = 0; int error = 0;
int enabled = 0; int enabled = 0;
@@ -565,7 +507,10 @@ asynStatus beamShiftAxis::enable(bool on) {
if (on) { if (on) {
// Check if the axis is currently switched off // Check if the axis is currently switched off
snprintf(command, sizeof(command), "P158 P159"); snprintf(command, sizeof(command), "P158 P159");
status = pC_->writeRead(axisNo(), command, response, 2); asynStatus status = pC_->writeRead(axisNo(), command, response, 2);
if (status != asynSuccess) {
return status;
}
nvals = sscanf(response, "%d %d", &enabled, &error); nvals = sscanf(response, "%d %d", &enabled, &error);
if (nvals != 2) { if (nvals != 2) {
@@ -581,36 +526,17 @@ asynStatus beamShiftAxis::enable(bool on) {
// path. // path.
handleError(error, userMessage, sizeof(userMessage)); handleError(error, userMessage, sizeof(userMessage));
status = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (status != asynSuccess) { setAxisParamChecked(this, motorMessageText, userMessage);
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
status = setStringParam(pC_->motorMessageText(), userMessage);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorMessageText_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
return asynError; return asynError;
} }
return asynSuccess; return asynSuccess;
} else { } else {
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d\nAxis cannot be " "Controller \"%s\", axis %d => %s, line %d\nAxis cannot be "
"switched off.\n", "switched off.\n",
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__); pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__);
status = setAxisParamChecked(this, motorMessageText, "Cannot be switched off.");
setStringParam(pC_->motorMessageText(), "Cannot be switched off.");
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorMessageText_",
axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
return asynError; return asynError;
} }
} }

View File

@@ -3,7 +3,7 @@
#include "turboPmacAxis.h" #include "turboPmacAxis.h"
#include "turboPmacController.h" #include "turboPmacController.h"
class beamShiftAxis : public turboPmacAxis { class HIDDEN beamShiftAxis : public turboPmacAxis {
public: public:
/** /**
* @brief Construct a new beamShiftAxis * @brief Construct a new beamShiftAxis