1 Commits

Author SHA1 Message Date
cb70054a72 Readded the PMAC driver for HRPT 2025-05-12 16:27:39 +02:00
7 changed files with 93 additions and 96 deletions

View File

@@ -1,21 +0,0 @@
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

51
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,51 @@
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

@@ -4,7 +4,7 @@ include /ioc/tools/driver.makefile
MODULE=sinq
BUILDCLASSES=Linux
EPICS_VERSIONS=7.0.7
ARCH_FILTER=RHEL8%
ARCH_FILTER=RHEL%
# additional module dependencies
REQUIRED+=SynApps
@@ -12,11 +12,13 @@ REQUIRED+=stream
REQUIRED+=scaler
REQUIRED+=motorBase
# Release version
LIBVERSION=2025-with-pmac
# DB files to include in the release
TEMPLATES += sinqEPICSApp/Db/dimetix.db
TEMPLATES += sinqEPICSApp/Db/slsvme.db
TEMPLATES += sinqEPICSApp/Db/spsamor.db
TEMPLATES += sinqEPICSApp/Db/el734.db
# DBD files to include in the release
DBDS += sinqEPICSApp/src/sinq.dbd
@@ -30,9 +32,9 @@ SOURCES += sinqEPICSApp/src/NanotecDriver.cpp
SOURCES += sinqEPICSApp/src/stptok.cpp
SOURCES += sinqEPICSApp/src/PhytronDriver.cpp
SOURCES += sinqEPICSApp/src/EuroMoveDriver.cpp
# SOURCES += sinqEPICSApp/src/pmacAsynIPPort.c
# SOURCES += sinqEPICSApp/src/pmacAxis.cpp
# SOURCES += sinqEPICSApp/src/pmacController.cpp
SOURCES += sinqEPICSApp/src/pmacAsynIPPort.c
SOURCES += sinqEPICSApp/src/pmacAxis.cpp
SOURCES += sinqEPICSApp/src/pmacController.cpp
SOURCES += sinqEPICSApp/src/MasterMACSDriver.cpp
SOURCES += sinqEPICSApp/src/C804Axis.cpp
SOURCES += sinqEPICSApp/src/C804Controller.cpp

View File

@@ -1,34 +0,0 @@
record(motor,"$(P)$(M)")
{
field(DESC,"$(DESC)")
field(DTYP,"$(DTYP)")
field(DIR,"$(DIR)")
field(VELO,"$(VELO)")
field(HVEL,"$(VELO)")
field(VBAS,"$(VELO)")
field(VMAX, "${VMAX}")
field(ACCL,"$(ACCL)")
field(BDST,"$(BDST)")
field(BVEL,"$(BVEL)")
field(BACC,"$(BACC)")
field(OUT,"@asyn($(PORT),$(ADDR))")
field(MRES,"$(MRES)")
field(PREC,"$(PREC)")
field(EGU,"$(EGU)")
field(DHLM,"$(DHLM)")
field(DLLM,"$(DLLM)")
field(INIT,"$(INIT)")
field(PINI, "NO")
field(TWV,"1")
field(RTRY,"0")
}
# The message text
record(waveform, "$(P)$(M)-MsgTxt") {
field(DTYP, "asynOctetRead")
field(INP, "@asyn($(PORT),$(N),1) MOTOR_MESSAGE_TEXT")
field(FTVL, "CHAR")
field(NELM, "80")
field(SCAN, "I/O Intr")
}

View File

@@ -48,7 +48,7 @@ January 2019
#include "PhytronDriver.h"
#include <epicsExport.h>
#define IDLEPOLL 5
#define IDLEPOLL 60
/** 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 ignoreLimitsX, int ignoreLimitsY)
int encX, int encY)
: 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, ignoreLimitsX);
new PhytronAxis(this, 2, encY, ignoreLimitsY);
new PhytronAxis(this, 1, encX);
new PhytronAxis(this, 2, encY);
}
@@ -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, 0, 0)
: PhytronController(portName, PhytronPortName, sel, encX, encY)
{
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 ignoreLimitsX, int ignoreLimitsY)
int encX, int encY)
{
new PhytronController(portName, PhytronPortName,selector, encX, encY, ignoreLimitsX, ignoreLimitsY);
new PhytronController(portName, PhytronPortName,selector, encX, encY);
return(asynSuccess);
}
@@ -178,10 +178,10 @@ PhytronDoseAxis* PhytronDoseController::getAxis(int axisNo)
asynStatus PhytronController::transactController(int axisNo,char command[COMLEN], char reply[COMLEN])
{
asynStatus status = asynSuccess;
size_t in = 0, out = 0;
int reason = 0;
char myReply[COMLEN+10] = {0}, myCommand[COMLEN+10] = {0}, *pPtr = {0};
asynStatus status;
size_t in, out;
int reason;
char myReply[COMLEN+10], myCommand[COMLEN+10], *pPtr;
SINQAxis *axis = getAxis(axisNo);
@@ -237,12 +237,11 @@ asynStatus PhytronController::transactController(int axisNo,char command[COMLEN]
*
* Initializes register numbers, etc.
*/
PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc, int ignoreLimits)
PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
: SINQAxis(pC, axisNo),
pC_(pC)
{
encoder = enc;
ignore_limits = ignoreLimits;
if(axisNo == 1){
phytronChar = 'X';
} else {
@@ -251,8 +250,6 @@ PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc, int ignoreL
haveBrake = 0;
brakeIO = -1;
next_poll = -1;
homing = 0;
homing_direction = 0;
}
int PhytronAxis::setBrake(int brakeNO)
@@ -437,9 +434,8 @@ asynStatus PhytronAxis::setPosition(double position)
errlogPrintf("PhytronAxis::setPosition called with %lf\n", position);
// writing encoder register is wrong
//sprintf(command, "%s%cP22S%f", pC_->selector,phytronChar, position/1000.);
//status = pC_->transactController(axisNo_,command,reply);
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;
@@ -469,6 +465,8 @@ asynStatus PhytronAxis::poll(bool *moving)
{
asynStatus comStatus = asynSuccess;
char command[COMLEN], reply[COMLEN];
double lowlim;
// protect against excessive polling
if(time(NULL) < next_poll){
@@ -538,7 +536,13 @@ asynStatus PhytronAxis::poll(bool *moving)
if(!*moving) {
if(homing){
setIntegerParam(pC_->motorStatusAtHome_, true);
if(homing_direction) {
pC_->getDoubleParam(axisNo_,pC_->motorHighLimit_,&lowlim);
} else {
pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowlim);
}
setPosition(lowlim);
setIntegerParam(pC_->motorStatusAtHome_, true);
} else {
/*
check limits and errors, upper
@@ -550,7 +554,7 @@ asynStatus PhytronAxis::poll(bool *moving)
updateMsgTxtFromDriver("No connection to phytron controller");
goto skip;
}
if(strstr(reply,"ACKE") != NULL && ignore_limits == 0){
if(strstr(reply,"ACKE") != NULL){
setIntegerParam(pC_->motorStatusHighLimit_, true);
updateMsgTxtFromDriver("Hit High Limit");
comStatus = asynError;
@@ -569,7 +573,7 @@ asynStatus PhytronAxis::poll(bool *moving)
updateMsgTxtFromDriver("No connection to phytron controller");
goto skip;
}
if(strstr(reply,"ACKE") != NULL && ignore_limits == 0){
if(strstr(reply,"ACKE") != NULL){
setIntegerParam(pC_->motorStatusLowLimit_, true);
updateMsgTxtFromDriver("Low Limit Hit");
comStatus = asynError;
@@ -610,7 +614,7 @@ asynStatus PhytronAxis::poll(bool *moving)
*/
PhytronDoseAxis::PhytronDoseAxis(PhytronController *pC, int axisNo, int enc)
: PhytronAxis(pC, axisNo, enc, 0)
: PhytronAxis(pC, axisNo, enc)
{
if(axisNo == 1){
doseChar = '3';
@@ -714,19 +718,15 @@ 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,
&PhytronCreateControllerArg5,
&PhytronCreateControllerArg6};
static const iocshFuncDef PhytronCreateControllerDef = {"PhytronCreateController", 7, PhytronCreateControllerArgs};
&PhytronCreateControllerArg2,
&PhytronCreateControllerArg3,
&PhytronCreateControllerArg4};
static const iocshFuncDef PhytronCreateControllerDef = {"PhytronCreateController", 5, PhytronCreateControllerArgs};
static void PhytronCreateContollerCallFunc(const iocshArgBuf *args)
{
PhytronCreateController(args[0].sval, args[1].sval, args[2].sval, args[3].ival,args[4].ival, args[5].ival, args[6].ival);
PhytronCreateController(args[0].sval, args[1].sval, args[2].sval, args[3].ival,args[4].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, int ignoreLimits);
PhytronAxis(class PhytronController *pC, int axis, int enc);
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,7 +50,6 @@ protected:
int homing_direction; /*1 forward, 0 backwards */
time_t next_poll;
int encoder;
int ignore_limits;
int haveBrake;
int brakeIO;
@@ -75,7 +74,7 @@ PhytronDoseController *pC_;
class PhytronController : public SINQController {
public:
PhytronController(const char *portName, const char *PhytronPortName, const char *selector,
int encX, int encY, int ignoreLimitsX, int ignoreLimitsY);
int encX, int encY);
void report(FILE *fp, int level);
PhytronAxis* getAxis(asynUser *pasynUser);

View File

@@ -5,9 +5,9 @@ registrar(EL734Register)
registrar(PhytronRegister)
registrar(EuroMoveRegister)
registrar(NanotecRegister)
# registrar(pmacControllerRegister)
registrar(pmacControllerRegister)
registrar(C804ControllerRegister)
# registrar(pmacAsynIPPortRegister)
registrar(pmacAsynIPPortRegister)
registrar(MasterMACSRegister)
registrar(SINQControllerRegister)