5 Commits

Author SHA1 Message Date
6d46b3ac0c Remove problematic parts, introduce ignore limits
Some checks failed
Test And Build / Build (push) Successful in 6s
Test And Build / Lint (push) Failing after 8s
Remove writing of epics limits to position after homing
Remove writing of the encoder register in set position, this seems
conceptually very wrong to do.
Introudce an argument to ignore limits in the poll, for example to acoid
weird behavior for rotational stages
2025-09-25 17:00:53 +02:00
ed0525e811 phytron: home_zero and initialize some variables
Some checks failed
Test And Build / Build (push) Successful in 7s
Test And Build / Lint (push) Failing after 7s
2025-09-11 11:27:56 +02:00
683fa2138f adds gitea action
Some checks failed
Test And Build / Lint (push) Failing after 7s
Test And Build / Build (push) Successful in 7s
2025-07-04 14:35:07 +02:00
354e9d90fb Fixed missing initializer for variables in Phytron-Axis 2025-06-20 13:46:10 +02:00
deea821e3f Merge pull request 'el734' (#2) from el734 into master
Reviewed-on: #2
2025-06-11 15:07:19 +02:00
4 changed files with 55 additions and 84 deletions

View File

@@ -0,0 +1,21 @@
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 sinqEPICSApp/src/*.cpp
- name: formatting
run: clang-format --style=file --Werror --dry-run sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h
Build:
runs-on: linepics
steps:
- name: checkout repo
uses: actions/checkout@v4
- run: |
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile.RHEL8
make -f Makefile.RHEL8 install

View File

@@ -1,51 +0,0 @@
default:
image: docker.psi.ch:5000/wall_e/sinqepics:latest
stages:
- test
- build
cppcheck:
stage: test
script:
- cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 sinqEPICSApp/
allow_failure: true # Long term this needs to be removed
artifacts:
expire_in: 1 week
tags:
- docker
formatting:
stage: test
script:
- clang-format --style=file --Werror --dry-run sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h
allow_failure: true # Long term this needs to be removed
artifacts:
expire_in: 1 week
tags:
- docker
# clangtidy:
# stage: test
# script:
# - curl https://docker.psi.ch:5000/v2/_catalog
# # - dnf update -y
# # - dnf install -y clang-tools-extra
# # - clang-tidy sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h -checks=cppcoreguidelines-*,cert-*
# # tags:
# # - docker
build_module:
stage: build
script:
- sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile.RHEL8
- make -f Makefile.RHEL8 install
- cp -rT "/ioc/modules/sinq/$(ls -U /ioc/modules/sinq/ | head -1)" "./sinq-${CI_COMMIT_SHORT_SHA}"
artifacts:
name: "sinq-${CI_COMMIT_SHORT_SHA}"
paths:
- "sinq-${CI_COMMIT_SHORT_SHA}/*"
expire_in: 1 week
when: always
tags:
- docker

View File

@@ -48,7 +48,7 @@ January 2019
#include "PhytronDriver.h"
#include <epicsExport.h>
#define IDLEPOLL 60
#define IDLEPOLL 5
/** Creates a new PhytronController object.
* \param[in] portName The name of the asyn port that will be created for this driver
@@ -56,7 +56,7 @@ January 2019
* \param[in] numAxes The number of axes that this controller supports
*/
PhytronController::PhytronController(const char *portName, const char *PhytronPortName, const char *sel ,
int encX, int encY)
int encX, int encY, int ignoreLimitsX, int ignoreLimitsY)
: SINQController(portName, PhytronPortName,2)
{
asynStatus status;
@@ -82,8 +82,8 @@ PhytronController::PhytronController(const char *portName, const char *PhytronPo
new PhytronDoseAxis(this, 1, encX);
new PhytronDoseAxis(this, 2, encY);
} else {
new PhytronAxis(this, 1, encX);
new PhytronAxis(this, 2, encY);
new PhytronAxis(this, 1, encX, ignoreLimitsX);
new PhytronAxis(this, 2, encY, ignoreLimitsY);
}
@@ -92,7 +92,7 @@ PhytronController::PhytronController(const char *portName, const char *PhytronPo
PhytronDoseController::PhytronDoseController(const char *portName, const char *PhytronPortName, const char *sel ,
int encX, int encY)
: PhytronController(portName, PhytronPortName, sel, encX, encY)
: PhytronController(portName, PhytronPortName, sel, encX, encY, 0, 0)
{
new PhytronDoseAxis(this, 1, encX);
new PhytronDoseAxis(this, 2, encY);
@@ -106,9 +106,9 @@ PhytronDoseController::PhytronDoseController(const char *portName, const char *P
* \param[in] numAxes The number of axes that this controller supports
*/
extern "C" int PhytronCreateController(const char *portName, const char *PhytronPortName, const char *selector,
int encX, int encY)
int encX, int encY, int ignoreLimitsX, int ignoreLimitsY)
{
new PhytronController(portName, PhytronPortName,selector, encX, encY);
new PhytronController(portName, PhytronPortName,selector, encX, encY, ignoreLimitsX, ignoreLimitsY);
return(asynSuccess);
}
@@ -178,10 +178,10 @@ PhytronDoseAxis* PhytronDoseController::getAxis(int axisNo)
asynStatus PhytronController::transactController(int axisNo,char command[COMLEN], char reply[COMLEN])
{
asynStatus status;
size_t in, out;
int reason;
char myReply[COMLEN+10], myCommand[COMLEN+10], *pPtr;
asynStatus status = asynSuccess;
size_t in = 0, out = 0;
int reason = 0;
char myReply[COMLEN+10] = {0}, myCommand[COMLEN+10] = {0}, *pPtr = {0};
SINQAxis *axis = getAxis(axisNo);
@@ -237,11 +237,12 @@ asynStatus PhytronController::transactController(int axisNo,char command[COMLEN]
*
* Initializes register numbers, etc.
*/
PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc, int ignoreLimits)
: SINQAxis(pC, axisNo),
pC_(pC)
{
encoder = enc;
ignore_limits = ignoreLimits;
if(axisNo == 1){
phytronChar = 'X';
} else {
@@ -250,6 +251,8 @@ PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
haveBrake = 0;
brakeIO = -1;
next_poll = -1;
homing = 0;
homing_direction = 0;
}
int PhytronAxis::setBrake(int brakeNO)
@@ -434,8 +437,9 @@ asynStatus PhytronAxis::setPosition(double position)
errlogPrintf("PhytronAxis::setPosition called with %lf\n", position);
sprintf(command, "%s%cP22S%f", pC_->selector,phytronChar, position/1000.);
status = pC_->transactController(axisNo_,command,reply);
// writing encoder register is wrong
//sprintf(command, "%s%cP22S%f", pC_->selector,phytronChar, position/1000.);
//status = pC_->transactController(axisNo_,command,reply);
sprintf(command, "%s%cP20S%f", pC_->selector,phytronChar, position/1000.);
status = pC_->transactController(axisNo_,command,reply);
next_poll = -1;
@@ -465,8 +469,6 @@ asynStatus PhytronAxis::poll(bool *moving)
{
asynStatus comStatus = asynSuccess;
char command[COMLEN], reply[COMLEN];
double lowlim;
// protect against excessive polling
if(time(NULL) < next_poll){
@@ -536,13 +538,7 @@ asynStatus PhytronAxis::poll(bool *moving)
if(!*moving) {
if(homing){
if(homing_direction) {
pC_->getDoubleParam(axisNo_,pC_->motorHighLimit_,&lowlim);
} else {
pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowlim);
}
setPosition(lowlim);
setIntegerParam(pC_->motorStatusAtHome_, true);
setIntegerParam(pC_->motorStatusAtHome_, true);
} else {
/*
check limits and errors, upper
@@ -554,7 +550,7 @@ asynStatus PhytronAxis::poll(bool *moving)
updateMsgTxtFromDriver("No connection to phytron controller");
goto skip;
}
if(strstr(reply,"ACKE") != NULL){
if(strstr(reply,"ACKE") != NULL && ignore_limits == 0){
setIntegerParam(pC_->motorStatusHighLimit_, true);
updateMsgTxtFromDriver("Hit High Limit");
comStatus = asynError;
@@ -573,7 +569,7 @@ asynStatus PhytronAxis::poll(bool *moving)
updateMsgTxtFromDriver("No connection to phytron controller");
goto skip;
}
if(strstr(reply,"ACKE") != NULL){
if(strstr(reply,"ACKE") != NULL && ignore_limits == 0){
setIntegerParam(pC_->motorStatusLowLimit_, true);
updateMsgTxtFromDriver("Low Limit Hit");
comStatus = asynError;
@@ -614,7 +610,7 @@ asynStatus PhytronAxis::poll(bool *moving)
*/
PhytronDoseAxis::PhytronDoseAxis(PhytronController *pC, int axisNo, int enc)
: PhytronAxis(pC, axisNo, enc)
: PhytronAxis(pC, axisNo, enc, 0)
{
if(axisNo == 1){
doseChar = '3';
@@ -718,15 +714,19 @@ static const iocshArg PhytronCreateControllerArg1 = {"Phytron port name", iocshA
static const iocshArg PhytronCreateControllerArg2 = {"Phytron Selector", iocshArgString};
static const iocshArg PhytronCreateControllerArg3 = {"EncoderX", iocshArgInt};
static const iocshArg PhytronCreateControllerArg4 = {"EncoderY", iocshArgInt};
static const iocshArg PhytronCreateControllerArg5 = {"IgnoreLimitsX", iocshArgInt};
static const iocshArg PhytronCreateControllerArg6 = {"IgnoreLimitsY", iocshArgInt};
static const iocshArg * const PhytronCreateControllerArgs[] = {&PhytronCreateControllerArg0,
&PhytronCreateControllerArg1,
&PhytronCreateControllerArg2,
&PhytronCreateControllerArg3,
&PhytronCreateControllerArg4};
static const iocshFuncDef PhytronCreateControllerDef = {"PhytronCreateController", 5, PhytronCreateControllerArgs};
&PhytronCreateControllerArg2,
&PhytronCreateControllerArg3,
&PhytronCreateControllerArg4,
&PhytronCreateControllerArg5,
&PhytronCreateControllerArg6};
static const iocshFuncDef PhytronCreateControllerDef = {"PhytronCreateController", 7, PhytronCreateControllerArgs};
static void PhytronCreateContollerCallFunc(const iocshArgBuf *args)
{
PhytronCreateController(args[0].sval, args[1].sval, args[2].sval, args[3].ival,args[4].ival);
PhytronCreateController(args[0].sval, args[1].sval, args[2].sval, args[3].ival,args[4].ival, args[5].ival, args[6].ival);
}
static const iocshArg PhytronDoseCreateControllerArg0 = {"Port name", iocshArgString};

View File

@@ -30,7 +30,7 @@ class PhytronAxis : public SINQAxis
{
public:
/* These are the methods we override from the base class */
PhytronAxis(class PhytronController *pC, int axis, int enc);
PhytronAxis(class PhytronController *pC, int axis, int enc, int ignoreLimits);
void report(FILE *fp, int level);
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration);
asynStatus moveVelocity(double min_velocity, double max_velocity, double acceleration);
@@ -50,6 +50,7 @@ protected:
int homing_direction; /*1 forward, 0 backwards */
time_t next_poll;
int encoder;
int ignore_limits;
int haveBrake;
int brakeIO;
@@ -74,7 +75,7 @@ PhytronDoseController *pC_;
class PhytronController : public SINQController {
public:
PhytronController(const char *portName, const char *PhytronPortName, const char *selector,
int encX, int encY);
int encX, int encY, int ignoreLimitsX, int ignoreLimitsY);
void report(FILE *fp, int level);
PhytronAxis* getAxis(asynUser *pasynUser);